11.3.103 initialization/1 [ISO,declaration]

Synopsis

:- initialization +Goal

Declares that Goal is to be run when the file in which the declaration appears is loaded into a running system, or when a stand-alone program or runtime system that contains the file is started up.

Arguments

:Goal
callable, must be nonvar

Description

Callable at any point during loading of a file. That is, it can be used as a directive, or as part of a goal called at load time. The initialization goal will be run as soon as the loading of the file is completed. That is at the end of the load, and notably after all other directives appearing in the file have been run.

save_program/[1,2] saves initialization goals in the saved state, so that they will run when the saved state is restored.

Goal is associated with the file loaded and a module. When a file, or module, is going to be reloaded, all goals earlier installed by that file or in that module, are removed. This is done before the actual load, thus allowing a new initialization Goal to be specified, without creating duplicates.

Comments

initialization is not an ISO predefined prefix operator.

Exceptions

instantiation_error
The argument Goal is not instantiated.

See Also

Initializations.


Send feedback on this subject.