initialization/1
declaration, ISO:- 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.
callable, must be nonvar
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. When
they run, they have access to the load context
(prolog_load_context/2
), just like other goals appearing in
directives.
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.
initialization
is not an ISO predefined prefix operator.
instantiation_error
The argument Goal is not instantiated.
context_error
Initialization appeared in a goal.
permission_error
Initialization appeared as a clause.