Example
We would like to initialize an array of integers in a Mosel program with data held in the C program that executes it:
model "Test initialization in memory"
 uses "meminit"
 parameters
  MEMDAT=''              ! Location of data in memory
  MEMSIZ=0               ! Size of the data block (nb of integers)
 end-parameters
 declarations
  a:array(1..20) of integer
 end-declarations
 writeln("Data located at ", MEMDAT, " contains ", MEMSIZ, " integers")
 meminit(a, MEMDAT, MEMSIZ)
 writeln("a=", a)
end-model A C program to execute the Mosel program meminit_test.mos printed above may look as follows:
int main()
{
 XPRMmodel mod;
 int result;
 char params[80];
 static int tabinit[]= {23,78,45,90,234,111,900,68,110};
 XPRMinit();                                       /* Initialize Mosel */
 XPRMcompmod("", "meminit_test.mos", NULL, NULL);  /* Compile the model */
 mod=XPRMloadmod("meminit_test.bim", NULL);        /* Load the model */
 /* Parameters: the address of the data table and its size */
 sprintf(params, "MEMDAT='%p', MEMSIZ=%d", tabinit, sizeof(tabinit)/sizeof(int));
 XPRMrunmod(mod, &result, params);                 /* Run the model */
 return result;
} 
                 
