This section discusses some differences that exist between compiling a
file into QOF with qpc
and compiling that file into memory
using compile/1
under the Development System. In certain cases,
if an application program was developed interactively using the
built-in compiler, some changes may have to be made to the code before
using qpc
to compile it and link it with the Development
Kernel or Runtime Kernel.
For example, if a file containing the following is compiled into memory, the
embedded command will succeed after writing an x
and a newline to the current
output stream.
f(x). f(z). :- f(X), write(X), nl.
Whereas, if the same file is given to qpc
, a warning will be
printed indicating that the embedded command failed. The reason for this is
that when qpc
compiles a Prolog file, it reads clauses from the
source file one after the other and compiles them into a QOF file. The
clauses for f/1
are not kept in memory, and the attempt to access them fails.
You do not need to read this section if both of the following are true.
term_expansion/2
to transform your source code at
compile-time.