To specify a callback function, the LINGO exported routine LSsetCallback needs to be called before calling LINGO’s script processor. The callback function will be called frequently by the LINGO solver.

The calling sequence for LSsetCallbackSolverLng is as follows:

int LSsetCallbackSolverLng( pLSenvLINGO pL, lngCBFuncError_t pcbf, void* pUserData)

Arguments:

pL     Pointer to a LINGO environment created by a previous call to LScreateEnvLng().
pcbfPointer to your callback routine.
pUserDataThis is a user specified pointer. You may use it to point to any data you might need to reference from your callback function. LINGO merely passes the value of this pointer through to your callback function. You may set this pointer to NULL if it is not required.

Return Value:

Returns 0 if no error occurred. Otherwise, it returns one of the nonzero error codes listed in the LINGO DLL Error Codes section.

The callback function must use the standard call convention and must have the following interface:

int MySolverCallback( pLSenvLINGO pL, int nReserved, void* pUserData);

Your computer will most likely crash if this interface specification is not followed exactly. The nReserved argument is reserved for future use and may be ignored.

Once the callback function has control, information regarding the solver’s status can be retrieved from LINGO using the LSgetCallbackInfoLng() function. See the Functions Exported by the LINGO DLL section for more information on the LSgetCallbackInfoLng() interface.