next up previous
Next: Listing Predicates and Up: Consulting Prolog Source Previous: Consulting Prolog Source

Quick Load Files

The features described in this section should be regarded alpha.

As of version 2.0.0, SWI-Prolog supports compilation of individual or multiple Prolog sourcefiles into `Quick Load Files'. A `Quick Load Files' ( .qlf file) stores the contents of the file in a precompiled format very similar to compiled files created using the -b and -c flags (see section gif).

These files load considerably faster than sourcefiles and are normally more compact. They are machine independent and may thus be loaded on any implementation of SWI-Prolog. Note however that clauses are stored as virtual machine instructions. Changes to the compiler will generally make old compiled files unusable.

Quick Load Files are created using qcompile/1. They may be loaded explicitely using qload/1 or implicitely using consult/1 or one of the other file-loading predicates described in section gif. If consult is given the explicit .pl file, it will load the Prolog source. When given the .qlf file, it will call qload/1 to load the file. When no extension is specified, it will load the .qlf file when present and the .pl file otherwise.

qcompile( +File)

  Takes a single file specification like consult/1 (i.e. accepts constructs like library(LibFile) and creates a Quick Load File from File. The file-extension of this file is .qlf. The base name of the Quick Load File is the same as the input file.

If the file contains `:- consult(+File)' or `:- [+File]' statements, the referred files are compiled into the same .qlf file. Other directives will be stored in the .qlf file and executed in the same fashion as when loading the .pl file.

For term_expansion/2, the same rules as described in section gif apply.

Source references ( source_file/2) in the Quick Load File refer to the Prolog source file from which the compiled code originates.

qload( +File)

  Loads the `Quick Load File'. It has the same semantics as consult/1 for a normal sourcefile. Equivalent to consult(File) iff File refers to a `Quick Load File'.



next up previous
Next: Listing Predicates and Up: Consulting Prolog Source Previous: Consulting Prolog Source



Passani Luca
Tue Nov 14 08:58:33 MET 1995