The library will be loaded into the caller module unless there is an explicit :- module directive in the file.
The search path used when loading libraries is specified by the global flag library_path using the get_flag/2 and set_flag/2 predicates. This flag contains a list of strings containing the pathnames of the directories to be searched when loading a library file. User libraries may be added to the system simply by copying the desired file into the ECLiPSe library directory. Alternatively the library_path flag may be updated to point at a number of user specific directories.
lib(Lib) is similar to use_module(library(Lib)), however with lib/1 it is possible to load files that do not contain any module definitions or those with a different name than the file name. Another difference is that lib/1 uses ensure_loaded/1 to load the file and so it is recompiled if the file has been modified.
Success: [eclipse]: lib(sorts). loading the library /usr/local/ECLIPSE/lib/sorts.pl yes. [eclipse]: lib(sorts). yes. % library already loaded - succeeds Error: lib(X). (Error 4). lib(1). (Error 5). lib(no_lib). (Error 173).