Switch to CM Details [ Switch Programming User's Guide ] MPE/iX 5.0 Documentation
Switch Programming User's Guide
Switch to CM Details
Switch requires the following information to call a CM procedure from an
NM procedure:
* Name of the CM SL routine and the library containing it or the 16-bit
CM plabel of a currently loaded copy of the routine
* Number of parameters in the calling sequence of the CM SL routine
* Length of each actual parameter
* For each parameter, a designation as an input parameter, an output
parameter, or both
* For each parameter, an indication whether the CM SL routine expects
that parameter to be a value parameter or a reference parameter;
reference parameters require the further specification of a word or
byte address
* Whether the CM procedure is a procedure or a function
Note that there are two ways to specify the target procedure, by name or
by plabel.
You can supply the ASCII name of the target each time it is called. In
this case, Switch automatically loads the procedure from the library the
first time it is invoked. Thereafter, Switch uses an internal hash table
to find the already loaded procedure.
Instead of specifying the target by name and encountering the lookup
overhead, you can call an intrinsic procedure (HPLOADCMPROCEDURE or
LOADPROC) to obtain the target's plabel and supply that to Switch instead
of the name. You must save the plabel for use in subsequent calls.
Switch needs the parameter length information for parameters because, in
most cases, it must copy data from the NM data space to the CM stack. If
the target procedure is callable in split-stack mode (requiring
Privileged Mode), and if the reference parameters are close enough to
each other to fit in a CM extra data segment, and if the reference
parameters are big enough to justify the overhead of a copy operation,
then you can request that HPSWITCHTOCM wrap the reference parameters in
an extra data segment and call the CM procedure in split-stack mode.
MPE/iX 5.0 Documentation