Initializing help system before first use

XSLPsetfuncobject

XSLPsetfuncobject


Purpose
Change the address of one of the objects which can be accessed by the user functions
Synopsis
int XPRS_CC XSLPsetfuncobject(int *ArgInfo, int ObjType, void *Address)
Arguments
ArgInfo 
The array of argument information for the user function.
ObjType 
An integer indicating which object is to be changed
XSLP_GLOBALFUNCOBJECT 
The Global Function Object;
XSLP_USERFUNCOBJECT 
The User Function Object for the function;
XSLP_INSTANCEFUNCOBJECT 
The Instance Function Object for the instance of the function.
Address 
The address of the object.
Example
The following example from within a user function checks if there is a function instance. If so, it gets the Instance Function Object. If it is NULL an array is allocated and its address is saved as the new Instance Function Object.
int Instance;
XSLPgetfuncinfo(ArgInfo, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, &Instance);
if (Instance) {
 XSLPgetfuncobject(ArgInfo, XSLP_INSTANCEFUNCOBJECT,
                   &Object);
 if (Object == NULL) {
  Object = calloc(4*3, sizeof(double));
  XSLPsetfuncobject(ArgInfo, XSLP_INSTANCEFUNCOBJECT,
                    Object);
 }
}

Further information

This function changes the address of one of the objects which can be accessed by any user function. It requires the ArgInfo array of argument information. This is normally provided as one of the arguments to a user function, or it can be created by using the function XSLPsetuserfuncinfo

The identity of the function and the instance are obtained from the ArgInfo array. Within a user function, therefore, using the ArgInfo array passed to the user function will change the objects accessible to that function.

If, instead, XSLPsetfuncobject is used with an array which has been populated by XSLPsetuserfuncinfo, the Global Function Object can be set as usual. The User Function Object cannot be set (use XSLPchguserfuncobject for this purpose). There is no Instance Function Object as such; however, a value can be set by XSLPsetfuncobject which can be used by the function subsequently called by XSLPcalluserfunc. It is the user's responsibility to manage the object and save and restore the address as necessary, because Xpress NonLinear will not retain the information itself.

If Address is NULL, then the corresponding information will be unchanged.


Related topics