Adding Functions |
![]() ![]() |
Functions are added by calling mb_register_func. The third parameter specifies the address of a callback function that implements the function. The callback function parses and validates the supplied parameters and performs any processing necessary to implement the function. A number of higher level macros have been implemented to make the parsing and validation simple. The callback functions do not have to be exported and it is recommended to keep the local to the DLL.
Example
// Register function in mb_ext_load mb_register_func( s, "INC", _my_inc_function ); . .
////////////////////////////////////////////////////// // Increment INTEGER parameter by 1 // Example: i = INC( i ) // int _my_inc_function( mb_interpreter_t* s, void** l ) { BEGIN_PARSE( s, l ) POP_INT( nPar ) END_PARSE
RETURN_INT( ++nPar ); }
|