Initializing help system before first use

# XPRS_ge_addcbmsghandler

Purpose
Declares an output callback function in the global environment, called every time a line of message text is output by any data in the library. This callback function will be called in addition to any output callbacks already added by XPRS_ge_addcbmsghandler.
Topic areas
Global Environment, Callback
Synopsis
`int XPRS_CC XPRS_ge_addcbmsghandler(int (XPRS_CC *msghandler)(XPRSobject xprsobj, void * cbdata, void * thread, const char * msg, int msgtype, int msgcode), void *data, int priority);`
Arguments

msghandler | The callback function, which takes arguments xprsobj, cbdata, thread, msg, msgtype and msgcode.
xprsobj | The data sending the message. Use XPRSgetobjecttypename to get the name of the data type.
cbdata | The user-defined data passed to the callback function.
thread | The system id of the thread sending the message cast to a void *.
msg | A null terminated character array (string) containing the message, which may simply be a new line. When the callback is called for the first time msg will be a NULL pointer.
msgtype | Indicates the type of output message:
1 | information messages;
2 | (not used);
3 | warning messages;
4 | error messages.
When the callback is called for the first time msgtype will be a negative value.
msgcode | The number associated with the message. If the message is an error or a warning then you can look up the number in the section Optimizer Error and Warning Messages for advice on what it means and how to resolve the associated issue.
data | A user-defined data to be passed to the callback function.
priority | An integer that determines the order in which multiple message handler callbacks will be invoked. The callback added with a higher priority will be called before a callback with a lower priority. Set to 0 if not required.

Further information
1. To send all messages to a log file the built in message handler XPRSlogfilehandler can be used. This can be done with:

    XPRS_ge_addcbmsghandler(XPRSlogfilehandler, "log.txt", 0);

2. The return value of the callback function msghandler is currently ignored.
Related topics
XPRS_ge_removecbmsghandler, XPRSgetobjecttypename.
Parent Topic Console and Library Functions

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.