Initializing help system before first use

Static modules

Modules are usually implemented as dynamic libraries: modules are represented as files that Mosel loads when required. It is also possible to embed a module into a program using the Mosel Libraries. In this case, the module must be registered in Mosel before it is used by any model. This registration is performed by a call to the function XPRMregstatdso which receives as parameters the name of the module (this is the name one uses to request the module in a uses directive in the model) and the reference to the initialization function of this module. The registration function initializes immediately the module by calling its initialization function and records the module as a static module (it cannot be unloaded). Note that the type of an initialization function of a static module is int instead of DSO_INIT.

Example:

#include "xprm_mc.h"
#include "xprm_ni.h"
int mymodule_init(XPRMnifct nifct, int *interver, int *libver, XPRMdsointer **interf);
...
int main()
{
 XPRMinit();
 XPRMregstatdso("mymodule", mymodule_init);
 /* Now the module "mymodule" is available */
 XPRMcompmod(NULL, "test.mos", NULL, NULL);
 ...
}

/* Functions of the module must be included in the program */
...