6.7.4.1 Initializing the Prolog Engine

The Prolog Engine is initialized by calling SP_initialize(). This must be done before any interface functions are called, except those marked ‘preinit’ in this manual.

The function will allocate data areas used by Prolog and load the Runtime Library.

It will also initialize command line arguments so that they can be accessed by the argv Prolog flag but it may be preferable to use SP_set_argv() for this.

To unload the SICStus emulator, SP_deinitalize() can be called.

You may also call SP_force_interactive() before calling SP_initialize(). This will force the I/O built-in predicates to treat the standard streams as a interactive, even if they do not appear to be connected to a terminal or console. Same as the -i option in development systems (see Start).

The SICStus Prolog memory manager has a two-layer structure. The top layer has roughly the same functionality as the standard UNIX functions malloc and free, whereas the bottom layer is an interface to the operating system. It is the bottom layer that can be customized by setting these hooks.


Send feedback on this subject.