Compiling and storing modules
Unless they are static, modules have to be compiled as dynamic libraries for the host operating system. The following table recalls the minimum set of options to use with the default C compilers for the supported operating systems. We assume here that the file mymodule.c contains the source of the module ``mymodule'' and that the environment variable MOSEL points to the installation directory of Mosel.
Linux:
gcc -D_REENTRANT -shared -I${MOSEL}/include -o mymodule.dso mymodule.c
Solaris:
cc -D_REENTRANT -G -I${MOSEL}/include -o mymodule.dso mymodule.c
Windows:
cl /MD /LD /I%MOSEL%\include /Femymodule.dso mymodule.c
The resulting DSO file has to be stored either in the dso directory of the Mosel installation or in a location that the environment variable MOSEL_DSO points to (this variable is defined in a similar way as the PATH environment variable, i.e. it is a list of directories).
Note that modules may also be written in C++. In this case, the initialization function has to be declared as a standard C function in order to be located by Mosel (this is not required for static modules).
Example:
extern "C" { DSO_INIT mymodule_init(XPRMnifct nifct, int *interver, int *libver, XPRMdsointer **interf) { ... } };