Automatic module initialisation?

Warwick Harvey wharvey at cs.monash.edu.au
Fri Feb 19 17:30:57 AEDT 1999


Hi folks,

Is it possible to get Mercury to automatically call an initialisation 
predicate/function for a module at start-up?  I'd prefer it if it were run 
automatically, so that whatever program imports the module does not need to 
know about it.

I had thought that getting an `INIT' line into the C code of the module 
(specifying a C function to call) would do the trick.  The semantics of this 
line have changed since I last fiddled with something like this, but I found 
the `--extra-inits' flag for c2init, which did get a reference to my 
initialisation function to appear in the program's _init.c file.  However, 
the initialisation function does not appear to be being called (even if I 
specify `--include-initialization-code' for c2init, if that has any bearing).

Am I trying to use the INIT flag for the wrong thing?  If so, is there 
another way of achieving the same effect?

Thanks,
Warwick




More information about the users mailing list