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, initialize command line arguments so that they can be accessed by the argv Prolog flag, and load the Runtime Library. 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 input stream as a terminal, even if it does not appear to be a terminal. Same as the -i option in development systems (see Start).

You may also call SP_set_memalloc_hooks() before calling SP_initialize(). This will define one layer of Prolog's memory manager, in case your application has special requirements.

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's the bottom layer that can be customized by setting these hooks.


Send feedback on this subject.