XPRBdefcbmsg
XPRBdefcbmsg |
Purpose
Synopsis
int XPRBdefcbmsg(XPRBprob prob, void (XPRB_CC *userprint)(XPRBprob my_prob, void *my_object, const char *msgtext), void *object);
Arguments
prob
|
Reference to a problem.
|
userprint
|
A user message handling function.
|
my_prob
|
Problem pointer passed to the callback function.
|
my_object
|
User-defined object passed to the callback function.
|
msgtext
|
The message text.
|
object
|
USer-defined object to be passed to the callback function.
|
Return value
0 if function executed successfully, 1 otherwise.
Example
The following defines a print function and then sets it as a callback.
XPRBprob prob; ... void myprint(XPRBprob prob, void *my_object, const char *msg); { printf("BCL output: %s\n", msg); } ... XPRBdefcbmsg(prob, myprint, NULL);
Further information
1. This function defines a callback function that returns any messages enabled by the setting of
XPRBsetmsglevel, including warnings and error messages, any other output produced by BCL, and any messages from the Optimizer library. Independent of the message printing settings, this callback also returns output printed by the user's program with function
XPRBprintf. If this callback is not defined by the user, any program output is printed to standard output with the exception of warnings and error messages which are printed to the standard error output channel.
2. 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 printing function set by this callback applies to all problems that are created subsequently. If this function is called after the creation of a problem, then the version without problem pointer will only influence the global BCL message handling settings, to change the settings for the specific problem you need to use the problem as its first argument. Global message handling settings apply to all situations where no problem information is available at the point from where the output is produced, otherwise the problem-specific message handling will be used.
3. A BCL program must
not reset the message callback
XPRSsetcbmessage of Xpress Optimizer— please use the callback chaining function
XPRSaddcbmessage (however, all other logging callbacks of the Optimizer may be defined either way).
Related topics