Switch to NM Details [ Switch Programming User's Guide ] MPE/iX 5.0 Documentation
Switch Programming User's Guide
Switch to NM Details
Switch requires the following information to call an NM procedure from a
CM procedure:
* Name of the procedure or an NM plabel (32-bits)
* If the NM procedure is specified by name, the following additional
items are required:
* Length of the procedure name
* NM library to search for the target procedure
* Length of the library name
* Number of parameters being passed to the NM procedure
* Array of values and/or pointers to the parameters being passed
* Array of descriptions of the parameters being passed
* Space reserved at the beginning of the parameter list for a function
return value, if calling a function
The CM --> NM Switch must make the parameters of the calling CM procedure
understandable to the NM procedure being called and must also make the
data value(s) and status returned by the NM procedure understandable to
the CM procedure.
The mechanism that Switch uses to enable mixed-mode calls in the CM -->
NM direction are the HPSWTONMNAME, HPSWTONMPLABEL, and HPLOADNMPROC
intrinsics. These intrinsics do address translation and copy parameters,
as needed.
These intrinsics differ only in the way they identify the target
procedure. HPSWTONMNAME uses the DB-relative address of a byte array
passed by reference to specify the target procedure, while HPSWTONMPLABEL
uses a 32-bit NM plabel (obtained from HPLOADNMPROC) to make this
specification. With HPSWTONMNAME, the NM loader converts the procedure
name to a plabel by means of a hashing function. HPSWTONMPLABEL
eliminates the overhead of this name-to-plabel mapping.
NOTE The first time a switch by name occurs in either direction, a load
from the library occurs. Thereafter, Switch uses an internal hash
table to quickly invoke the already loaded procedure.
MPE/iX 5.0 Documentation