next up previous contents index
Next: Changing the Default Search Up: System Description Previous: The Module System of   Contents   Index


The Dynamic Loader and its Search Path

The dynamic (or automatic) loader comprises one of XSB's differences from other Prolog systems. In XSB, the loading of user modules Prolog libraries (including the XSB compiler itself) is delayed until predicates in them are actually needed, saving program space for large Prolog applications. The delay in the loading is done automatically, unlike other systems where it must be explicitly specified for non-system libraries.

When a predicate imported from another module (see Section 3.3) is called during execution, the dynamic loader is invoked automatically if the module is not yet loaded into the system, The default action of the dynamic loader is to search for the byte code file of the module first in the system library directories (in the order lib, syslib, and then cmplib), and finally in the current working directory. If the module is found in one of these directories, then it will be loaded (on a first-found basis). Otherwise, an error message will be displayed on the current output stream reporting that the module was not found.

In fact, XSB loads the compiler and most system modules this way. Because of dynamic loading, the time it takes to compile a file is slightly longer than usual the first time the compiler is invoked in a session.



Subsections
next up previous contents index
Next: Changing the Default Search Up: System Description Previous: The Module System of   Contents   Index
Luis Fernando P. de Castro 2003-06-27