save_program/[1,2]

Synopsis

save_program(+File)

save_program(+File, +Goal)

Saves the state of the current execution in QOF format to File. A goal, Goal, to be called upon execution/restoring of the saved state, may be specified.

Arguments


File file_spec
An atom representing a filename.
Goal callable [MOD]
A goal.

Description

save_program/[1,2] creates a QOF representation of all predicates in all modules existing in the system. However, it does not save the user's pre-linked code. It also saves such states of the system as operator definitions, prolog_flags, debugging and advice state, and initializations. Object files dynamically loaded into the system are saved in the qof file as object dependencies.

The resulting file is executable, and can be started up as a command, or can be restored using restore/1.

save_program/[1,2] saves module import/export information, which gets reinstated when File is loaded. No new module-importation will be done when File is loaded, because it is assumed that it was done before save_program/[1,2] was called. Thus if your program consists of one or more modules, and you save it with save_program/[1,2], loading the resulting File into some new module will not import any of your predicates into that module. If you want to save out a module such that it will be imported automatically into any module from which it is loaded, then use save_modules/2.

Exceptions


instantiation_error
File or Goal is not bound.
type_error
File is not a valid file specification, or Goal is not a valid goal.
permission_error
File is not writable.

See Also

load_files/[1,2], restore/1, save_modules/2, save_predicates/2, volatile/1 ref-sls