next up previous contents index
Next: 3.6.1 Changing the Default Up: 3. System Description Previous: 3.5 Standard Predicates in   Contents   Index


3.6 The Dynamic Loader and its Search Path

XSB differs from some other Prolog system in its ability to dynamically load modules. In XSB, the loading of user modules Prolog libraries (such as the XSB compiler) is delayed until predicates in them are actually needed, saving program space for large Prolog applications. Dynamic loading is done by default, unlike other systems where it is not the default for non-system libraries.

When a predicate imported from another module (see Section 3.4) 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 error stream reporting that the module was not found. Because system modules are dynamically loaded, the time it takes to compile a file is slightly longer the first time the compiler is invoked in a session than for subsequent compilations.



Subsections
next up previous contents index
Next: 3.6.1 Changing the Default Up: 3. System Description Previous: 3.5 Standard Predicates in   Contents   Index
Terrance Swift 2007-10-05