Initializing help system before first use

XSLPsetuserfuncaddress

XSLPsetuserfuncaddress


Purpose
Change the address of a user function
Synopsis
int XPRS_CC XSLPsetuserfuncaddress(XSLPprob Prob, int nSLPUF, void *Address);
Arguments
Prob 
The current SLP problem.
nSLPUF 
The index of the user function.
Address 
The address of the user function.
Example
The following example defines a user function via XSLPchguserfunc and then re-defines the address.
double InternalFunc(double *, int *);
int nUF;

XSLPchguserfunc(Prob, 0, NULL, 023, 1,
                NULL, NULL, NULL);

XSLPgetintattrib(Prob,XSLP_UFS,&nUF);
XSLPaddnames(Prob,XSLP_USERFUNCNAMES,"Func1",
             nUF,nUF);

XSLPsetuserfuncaddress(Prob, nUF, InternalFunc);
Note that InternalFunc is defined as taking two arguments (double* and int*). This matches the ArgType setting in XSLPchguserfunc. The external function name is NULL because it is not required when the address is given.
Further information

nSLPUF is an Xpress NonLinear index and always counts from 1.

The address of the function is changed to the one provided. XSLPsetuserfuncaddress should only be used for functions declared as of type DLL. Its main use is where a user function is actually internal to the system rather than being provided in an external library. In such a case, the function is initially defined as an external function using XSLPloaduserfuncs, XSLPadduserfuncs or XSLPchguserfunc and the address of the function is then provided using XSLPsetuserfuncaddress.


Related topics