Debugging modules
Since modules are loaded dynamically by Mosel, it may be difficult to use a debugger for analysing the behaviour of the program. A work around consists in compiling the module as part of a simple program (static module) that initialises Mosel then executes a model (using the embeded module to debug). A debugger can be used on this program to trace the operation of the module which is not loaded dynamically any more.
Example: the following program can be used to debug the module `mymodule'.
#include <stdlib.h>
#include "xprm_mc.h"
#include "mymodule.c" /* Include the source of the module */
int main()
{
int rts;
XPRMinit(); /* Declare the module as static */
XPRMregstatdso("mymodule",mymodule_init);
/* Execute a test model */
XPRMexecmod("g","mymodule_test",NULL,&rts,NULL);
return rts;
} The program source dsodbg.c provided with the NI examples can be used as a shell for debugging modules.
