Initializing help system before first use

callproc

Purpose
Call a procedure/function of the running model.
Synopsis
int callproc(XPRMcontext ctx, XPRMproc proc, XPRMalltypes *parst);
Arguments
ctx 
Mosel's execution context
proc 
Reference to a routine (as returned by findident or getnextproc)
parst 
An array containing the parameters for the routine
Return value
XPRM_RT_OK if execution succeeded, an error code otherwise (as returned by XPRMrunmod).
Example
The following code extract shows how to call the function mosfct(i:integer,r:real):boolean.
void callfct(XPRMcontext ctx)
{
 XPRMalltypes fct,parst[2];

 mm->findident(ctx, "mosfct", &fct);
 parst[1].integer=10;
 parst[0].real=5.5;
 mm->printf(ctx, "mosfct(10,5.5)=");
 mm->callproc(ctx, fct.proc, parst);
 mm->printf(ctx, "%d", parst[0].boolean);
}
Further information
1. Execute the procedure or function proc that is defined in a currently running model. The routine reference is obtained from findident or getnextproc. In the array parst, the parameters for the function must be stored in reverse order. If the routine is a function, the return value is stored in the first cell of parst.
2. If the procedure terminates by calling exit(code), the return value is XPRM_RT_EXIT and the exit code is stored in the first cell of parst.
Related topics

© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.