next up previous index
Next: Redefining Built In Up: Getting started with Previous: Altering Programs

Using Libraries

  A number of files containing library predicates are issued with the ECLiPSe

system. These predicates provide utility functions for general use. They are usually installed in a ECLiPSe library directory (or directories). These predicates are either loaded automatically by ECLiPSe or may be loaded ``by hand''.

During the execution of an ECLiPSe program, the system may dynamically load files containing library predicates. When this happens, the user is informed by a compilation or loading message. It is possible to explicitly force this loading to occur by use of the lib/1 or use_module/1 predicates. E.g. to load the library called lists, use one of the following directives

:- lib(lists)
:- use_module(library(lists))
will load the library file unless it has been already loaded. The library file is found by searching the library path and by appending a suffix to the library name.

    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 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. The following example illustrates how a directive may be added to a file to add a user-defined library in front of any existing system libraries.

?- get_flag(library_path,Path),
   set_flag(library_path, ["/home/myuser/mylibs" | Path]).
The UNIX environment variable ECLIPSELIBRARYPATH may also be used to specify   the initial setting of the library path. The syntax is similar to the syntax of the UNIX PATH variable, i.e. a list of directory names separated by colons. The directories will be prepended to the standard library path in the given order.



next up previous index
Next: Redefining Built In Up: Getting started with Previous: Altering Programs



Micha Meier
Mon Mar 4 12:11:45 MET 1996