Compiling and Linking

There are two major tools needed to convert a set of source files into a stand-alone program or a runtime system:

  1. the compiler, qpc, which translates Prolog files into QOF files. This is described in sap-srs-qpc.
  2. the link editor, qld, which links one or more QOF files together and builds an executable file. Often the user will not need to call qld directly because qpc will do this automatically. The linker is described in sap-srs-qld.

It is also possible to build QOF files by saving them directly from a Prolog development system session, as described in ref-sls. QOF files saved in this way can then be used directly to build a stand-alone program with qld.

images/sap-steps.png

Major steps in creating a stand-alone program

qpc allows independent compilation of the files that make up an application program. The dotted box in the above figure illustrates this functionality.

The use of qpc and qld correspond to the use of the C compiler and linker as follows:

Quintus Prolog C

sources: a.pl a.c
compiler: qpc compiler
object files: a.qof e.g. a.o
linker: qld linker
executable: a.out e.g. a.out