Table: Key = Value pairs for save_program/2
As the entire data image of the current process will be saved on the new
executable it is desirable to keep this small. Notably the Prolog
machine stacks should be kept small. The best way to do this is first
to compile the program using the -c
option. If this is not
possible try to find the smallest possible stack sizes to compile the
program. On machines with dynamic stack allocation the stacks are
not written to file and so their size does not matter.
Figure shows a possible session. Note the use of
`initialise', which is supposed to be a predicate of the application
doing time consuming initialisation.
Figure: Create a stand-alone executable
The resulting program can be used for incremental compilation using -c or another save_program/2.
save_program(NewProgram, [])
'.
1 ?- save(state), format('Hello World~n'). Hello World Yes 2 ?- halt. machine% ./state Hello World Yes 2 ?- h. 1 save(state), format('Hello World~n'). 2 ?-
The save/1 predicate is normally used for debugging purposes. save_program/[1,2] is the preferred way to create a new program.