Compilation

Collections of SWI-Prolog source files can be compiled into an intermediate code file. An intermediate code file is a data file from which SWI-Prolog can be started. The command to compile a bundle of source files is:


\begin{code}
pl [options] [-o output] -c file ...
\end{code}

The individual source files may include other files using the standard list notation, consult/1, ensure_loaded/1 and use_module/[1,2]. When the -o file option is omitted a file named a.out is created that holds the intermediate code file.

Intermediate code files start with the BSD Unix magic code #! and are executable. This implies they can be started as a command:


\begin{code}
sun...
sun\end{code}

Alternatively, my_program can be started with
\begin{code}
sun\end{code}

The following restrictions apply to source files that are to be compiled with `-c':

Directives are executed both when compiling the program and when loading the intermediate code file.