Callback-function pointer

The third argument of the mi_register_callback() function is a callback-function pointer. The DataBlade® API stores a pointer to the location of a callback function in the MI_CALLBACK_FUNC data type.

In the mi_register_callback() function, you can specify the callback function in either of the following ways:
  • The name of the function.

    When you specify the function name as the third argument, mi_register_callback() creates a callback-function pointer from the function name.

    The sample callback registrations in Connection descriptor pass the name of the callback as the third argument of mi_register_callback(). Both of these registrations are the first time that the callback is registered within the module.

  • A pointer to an MI_CALLBACK_FUNC variable.

    If mi_register_callback() has already initialized a callback-function pointer, you can specify this pointer as the third argument of mi_register_callback().

    In the code fragment in Retrieving a callback function, the second registration of the initial_cback() function passes a pointer to an MI_CALLBACK_FUNC variable (&initial_cbptr) as the third argument of mi_register_callback().