Callback-function parameters

A callback function takes the following parameters.
Argument type Description Initialized by mi_register_callback()?
MI_EVENT_TYPE The event type that triggers the callback Yes
MI_CONNECTION * A pointer to the connection on which the event occurred

If the connection is undefined, it might be NULL, as is the case with some client-library errors and state-transition events.

Yes
void * A pointer to an event-type structure that holds event information

For example, if the event is an MI_Exception event, the DataBlade® API passes in an MI_ERROR_DESC structure, which holds the exception level and the message text.

No

The DataBlade® API sets this pointer to the associated event structure when it invokes the callback.

void * A pointer to any user data, which you can use to pass any additional information to and from the callback Yes
When you register a callback with the mi_register_callback() function, you provide arguments for most parameters of the callback. The following figure shows how a call to mi_register_callback() provides the arguments that initialize the parameters of the myhandler() callback.
Figure 1. Initializing a callback
begin figure description - This figure is described in the surrounding text. - end figure description

The only callback parameter that the mi_register_callback() call does not initialize is the event-type structure (the event_data parameter in Initializing a callback).