Previous Up Next

2.7  How do I use ECLiPSe libraries in my programs?

A number of files containing library predicates are supplied with the ECLiPSe system. They are usually installed in an ECLiPSe library directory. 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 goals:

:- lib(lists)
:- use_module(library(lists))

This will load the library file unless it has been already loaded. In particular, a program can ensure that a given library is loaded when it is compiled, by including an appropriate directive in the source, e.g. :- lib(lists).


Previous Up Next