There are three built-in Prolog predicates for managing external libraries: load_external_library/1, external_library/1 and unload_external_library/1.
Normally an external library is loaded into memory if a clause is called for the first time that is implemented in the external library. This can slow down the execution of this first call, with the predicate load_external_library/1 it is possible to load a library before a clause is called. With load_external_library/1 it is also possible to load external libraries which are not in the plugin subdirectory of the excutable nor in the directory of the exutable running the prolog program.
| load_external_library('numtest.dll'). |
| load_external_library('c:\\temp\\numtest.dll'). |
With external_library/1 it is possible to check if a certain external library is being used or not, the predicate is exited if the specified library file is used, else it fails.
| external_library('c:\\temp\\numtest.dll'). |
Removing an external library can be done with the built-in predicate unload_external_library/1. If the library is not actively being used by a call to a clause then the library is unloaded.
| unload_external_library('c:\\temp\\numtest.dll'). |
| For all these built-in predcates the name of the file to load is case insensitive when using Windows. |