31.2. Saving an Image
Prev | Chapter 31. Platform Independent Extensions | Next

## 31.2. Saving an Image

The function `(`EXT:SAVEINITMEM` `&OPTIONAL` (`filename` "lispinit.mem") `&KEY` :KEEP-GLOBAL-HANDLERS :QUIET :INIT-FUNCTION :LOCKED-PACKAGES :START-PACKAGE :EXECUTABLE :NORC :SCRIPT :DOCUMENTATION :VERBOSE)` saves the running CLISP's memory to the file `filename`; extension `#P".mem"` is recommended (when `filename` does not have an extension, `#P".mem"` extension is automatically added unless the file being created is an executable).

`:QUIET`

  If this argument is not `NIL`, the startup banner and the good-bye message will be suppressed, as if by `-q`.

  This is not recommended for interactive application delivery, please append your banner to ours (using init function) instead of replacing it.

`:VERBOSE`
  Print a message after writing the file. This argument defaults to `CUSTOM:*SAVEINITMEM-VERBOSE*`; initial value is `T`.
`:NORC`
  If this argument is not `NIL`, the RC file loading will be suppressed, as if by `-norc`.
`:INIT-FUNCTION`

  This argument specifies a function that will be executed at startup of the saved image, before entering the standard read-eval-print loop (but after all other initialization, see Section 31.1.1, “Cradle to Grave”); thus, if you want to avoid the read-eval-print loop, you have to call `EXT:EXIT` at the end of the init function yourself (this does not prevent `CUSTOM:*FINI-HOOKS*` from being run).

  See the manual for passing command line arguments to this function.

  See also `CUSTOM:*INIT-HOOKS*` and `CUSTOM:*FINI-HOOKS*`.

`:SCRIPT`

  This options determines the handling of positional arguments when the image is invoked.

  - If it is `T`, then the first positional argument is the script name and the rest is placed into `EXT:*ARGS*`, as described in Section 32.5.2, “Scripting with CLISP”.
  - It it is `NIL`, then all positional arguments are placed into `EXT:*ARGS*` to be handled by the init function.

  This option defaults to `T` when init function is `NIL` and to `NIL` when init function is non-`NIL`.

`:DOCUMENTATION`

  The description of what this image does, printed by the `-help-image` olption.

  Defaults to `(`DOCUMENTATION` init function '`FUNCTION`)`

`:LOCKED-PACKAGES`
  This argument specifies the packages to lock before saving the image; this is convenient for application delivery, when you do not want your users to mess up your product. This argument defaults to `CUSTOM:*SYSTEM-PACKAGE-LIST*`.
`:START-PACKAGE`
  This argument specifies the starting value of `*PACKAGE*` in the image being saved, and defaults to the current value of `*PACKAGE*`.
`:KEEP-GLOBAL-HANDLERS`

  When non-`NIL`, the currently established global handlers (either with `EXT:SET-GLOBAL-HANDLER` or with `-on-error`) are inherited by the image. Defaults to `NIL`, so that

      $ clisp -i myfile -x '(EXT:SAVEINITMEM)'

  will produce an image without any global handlers inherited from the batch mode of the above command.

`:EXECUTABLE`
  When non-`NIL`, the saved file will be an standalone executable. In this case, the `#P".mem"` extension is not added. On Win32 and Cygwin the extension `#P".exe"` is added instead.

You can use this memory image with the `-M` option. On UNIX systems, you may compress it with GNU gzip to save disk space.

### Image Portability

Memory images are not portable across different platforms (in contrast with platform-independent `#P".fas"` files). They are not even portable across linking sets: image saved using the full linking set cannot be used with the base runtime:

    $ clisp -K full -x '(EXT:SAVEINITMEM)'
    $ clisp -K base -M lispinit.mem
    base/lisp.run: initialization file `lispinit.mem' was not created by this version of CLISP runtime

See also `SFmail/BF6EFF38DF3FA647BBD932720D8BED650BAA11%40parmbx02.ilog.biz`/`Gmane/devel/17757`.

| These notes document CLISP version 2.45 | Last modified: 2008-05-14

Enter your search termsSubmit search form
Webclisp.cons.orgclisp.podval.orgwww.lisp.org

Prev | Up | Next
31.1. Customizing CLISP Process Initialization and Termination | Home | 31.3. Quitting CLISP