Next: Numeric, Previous: Dynamic Linking, Up: Packages [Contents][Index]
Dump, (also known as unexec), saves the continuation of an entire SCM session to an executable file, which can then be invoked as a program. Dumped executables start very quickly, since no Scheme code has to be loaded.
There are constraints on which sessions are savable using dump
dump
.
current-input-port
, current-output-port
,
current-error-port
), X windows, etc. are invalid in subsequent
invocations.
This restriction could be removed; See Improvements To Make.
Dump
should only be called from a loading file when the call to
dump is the last expression in that file.
Dump
can be called from the command line.
gc
.
If the optional argument is missing or a boolean, SCM’s standard command line processing will be called in the restored executable.
If the second argument to dump
is #t
, argument processing
will continue from the command line passed to the dumping session. If
the second argument is missing or #f
then the command line
arguments of the restoring invocation will be processed.
dump
may set the values of boot-tail
, *argv*
,
restart
, and *interactive*. dump
returns an
unspecified value.
When a dumped executable is invoked, the variable *interactive*
(see Internal State) has the value it possessed when dump
created it. Calling dump
with a single argument sets
*interactive* to #f
, which is the state it has at the
beginning of command line processing.
The procedure program-arguments
returns the command line
arguments for the curent invocation. More specifically,
program-arguments
for the restored session are not saved
from the dumping session. Command line processing is done on
the value of the identifier *argv*
.
The following example shows how to create ‘rscm’, which is like regular scm, but which loads faster and has the ‘random’ package alreadly provided.
bash$ scm -rrandom > (dump "rscm") #<unspecified> > (quit) bash$ ./rscm -lpi.scm -e"(pi (random 200) 5)" 00003 14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 70679 82148 08651 32823 06647 09384 46095 50582 23172 53594 08128 48111 74502 84102 70193 85211 05559 64462 29489 bash$
This task can also be accomplished using the ‘-o’ command line option (see Options).
bash$ scm -rrandom -o rscm > (quit) bash$ ./rscm -lpi.scm -e"(pi (random 200) 5)" 00003 14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 70679 82148 08651 32823 06647 09384 46095 50582 23172 53594 08128 48111 74502 84102 70193 85211 05559 64462 29489 bash$
Next: Numeric, Previous: Dynamic Linking, Up: Packages [Contents][Index]