The Prolog cross-referencer can automatically generate module/2
declarations from its cross-reference information. This is useful if
you want to take a set of files making up a program and make each of
those files into a module-file. For more information, see The Cross-Referencer
Alternatively, if you have a complete Prolog program consisting of a set of
source files {file1, file2, ...}
, and you wish to encapsulate it in a
single module mod, this can be done by creating a “driver”
file of the following form:
:- module(mod, [ ... ]). :- ensure_loaded(file1). :- ensure_loaded(file2). . . .
When a module is created in this way, none of the files in the program
{file1, file2, ...}
have to
be changed.