Purpose
Callback for user error handling.
Synopsis
int XPRBdefcberr(XPRBprob prob,
void (XPRB_CC *usererr)(XPRBprob my_prob, void *my_object,
int errnum, int type, const char *errtext), void *object);
Arguments
prob
|
Reference to a problem.
|
usererr
|
The user's error handling function.
|
my_prob
|
Problem pointer passed to the callback function.
|
my_object
|
User-defined object passed to the callback function.
|
errnum
|
The error number.
|
type
|
Type of the error. This will be one of:
|
errtext
|
Text of the error message.
|
object
|
User-defined object to be passed to the callback function.
|
Return value
0 if function executed successfully, 1 otherwise.
Example
In this example a function is defined for displaying errors and exiting if they are suitably severe. This function is then
set as the error-handling callback.
XPRBprob prob;
...
void myerr(XPRBprob my_prob, void *my_object, int num, int type,
const char *t)
{
printf("BCL error %d: %s\n", num, t);
if(type == XPRB_ERR) exit(0);
}
...
XPRBdefcberr(prob, myerror, NULL);
Further information
1. This function defines the error handling callback that returns the error number and text of error messages and warnings produced
by BCL for a given problem. A list of BCL error messages with some explanations can be found in the Appendix
BCL error messages of this manual. If printing of error or warning messages is enabled (see
XPRBsetmsglevel) these are printed after the call to this function.
2. It is recommended to define this callback function if the error handling by BCL is disabled (for instance in BCL programs
integrated into larger applications or in BCL programs executed under Windows). Alternatively it is of course possible to
test the return values of all BCL functions. However, the callback provides more detailed information about the type of error
that has occurred.
3. This function may be used before any problems have been created and even before BCL has been initialized (with first argument
NULL). In this case the error handling function set by this callback applies to all problems that are creted subsequently.
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.