save-image filename &key dll-exports dll-added-files dll-extra-link-options automatic-init gc type normal-gc restart-function multiprocessing console environment remarks clean-down image-type split => nil
A string. It is the name of the file that the image is saved as. This name should not be the same as the original name of the image.
A list of strings, or the keyword
A list of strings.
A generalized boolean.
If non-nil, there is a garbage collection before the image is saved. The default value is
Determines if some global variables are cleared before the image is saved. You can generally use the default value, which is
If this is
t the function normal-gc is called before the image is saved. The default is
A function to be called on restart.
Controls whether multiprocessing is enabled on restart. Possible values are discussed below.
On Windows console controls whether the new image will be a Console or GUI application and when, if ever, to make a console window in the latter case.
environment controls whether the LispWorks environment is started on restart. Possible values are discussed below.
remarks adds a comment to the save history. The value should be a string.
One of the keywords
A generalized boolean. If non-nil, the Lisp heap and the executable are saved in two separate files.
For information about the sort of changes you might want to save in a new image, see Customization of LispWorks.
Do not use
save-image when the graphical IDE is running. Instead create a build script and use it with the
-build command line argument similar to the examples below, or run LispWorks in a subprocess using the Application Builder tool.
dll-exports is implemented only on Windows, Linux, x86/x64 Solaris, Macintosh and FreeBSD. It controls whether the image saved is an executable or a dynamic library (DLL). The default value is
:default and this value means an executable is saved. The value
:com is supported on Microsoft Windows only (see below). Otherwise dll-exports should be list (potentially
nil). In this case a dynamic library is saved, and each string in dll-exports names a function which becomes an export of the dynamic library and should be defined as a Lisp function using
fli:define-foreign-callable. Each exported name can be found by
GetProcAddress (on Windows) or
dlsym (on other platforms). The exported symbol is actually a stub which ensures that the LispWorks dynamic library has finished initializing, and then enters the Lisp code.
On Microsoft Windows the dll-exports list can also contain the keyword
:com, or dll-exports can simply be the keyword
:com, both of which mean that the DLL is intended to be used as a COM server. See the
LispWorks COM/Automation User Guide and Reference Manual
On Mac OS X the default behavior is to generate an object of type "Mach-O dynamically linked shared library" with file type
dylib. See image-type below for information about creating another type of library on Mac OS X.
On Linux, Macintosh, x86/x64 Solaris and FreeBSD, to save a dynamic library image the computer needs to have a C compiler installed. This is typically
gcc (which is available by installing Xcode on the Macintosh).
automatic-init specifies whether a LispWorks dynamic library should initialize inside the call to
LoadLibrary (on Microsoft Windows) or
dlopen (on other platforms), or wait for further calls. Automatic initialization is useful when the dynamic library does not communicate by function calls. On Microsoft Windows it also allows
LoadLibrary to succeed or fail according to whether the LispWorks dynamic library initializes successfully or not. Not using automatic initialization allows you to relocate the library if necessary using InitLispWorks, and do any other initialization that may be required. The default value of automatic-init is
t on Windows,
nil on other platforms. For more information about automatic initialization in LispWorks dynamic libraries, see LispWorks as a dynamic library.
dll-added-files should be a list of filenames. It is ignored on Microsoft Windows. On other platforms if dll-added-files is non-nil then a dynamic library containing each named file is saved. Each file must be of a format that the default C compiler (
scm:*c-default-compiler*) knows about and can incorporate into a shared library. Typically they will be C source files, but can also be assembler or object files. They must not contain exports that clash with names in the LispWorks dynamic library (see Dynamic library C functions for the predefined exports). The added files are useful to write wrappers around calls into the LispWorks dynamic library. Such wrappers are useful for:
dlopen, by using
dll-extra-link-options should be a list of strings. It is ignored on Microsoft Windows. On other platforms if dll-extra-link-options is non-nil then the strings are passed as extra command line arguments to the linker. See the documentation for the linker (typically called
ld) for the operating system you are using for the meaning of these arguments. On Macintosh, a default value for the
-install_name option is generated using the file-namestring of the dynamic library if
"-install_name" is not specified in dll-extra-link-options.
:bundle is used only when saving a dynamic library. On Mac OS X it generates an object of type "Mach-O bundle" and is used for creating shared libraries that will be used by applications that cannot load dylibs (FileMaker for example). It also does not force the filename extension to be
dylib. On other Unix-like systems image-type merely has the effect of not forcing the file type of the saved image, and the format of the saved image is the same as the default. On Microsoft Windows image-type
:bundle is ignored.
If split is
nil (the default), then the saved image is written as a single executable file containing the Lisp heap. If split is
t, then the saved Lisp heap is split into a separate file, named by adding
.lwheap to the name of the executable. When the executable runs, it reloads the Lisp heap from this file automatically.
In addition, when saving LispWorks on the Macintosh as an application bundle (for example by using create-macos-application-bundle) or as a framework bundle, split can be the symbol
:resources. This places the Lisp heap file in the
Resources directory of the bundle, which allows the heap to be included in the bundle's signature. For an application bundle, the
Resources directory is in the
Contents directory alongside the
MacOS directory. For a framework bundle, the
Resources directory is alongside the shared library. The executable and Lisp heap file must be in these directories within the bundle at run time.
restart-function, if non-nil, specifies a function (with no arguments) to be called when the image is started. If multiprocessing is true, restart-function is called in a new process. restart-function is called after the initialization file is loaded. The default value of restart-function is
When multiprocessing is
nil, the executable image will start without multiprocessing enabled. When multiprocessing is true or the image is a DLL, the image will start with multiprocessing enabled, starting processes in the list *initial-processes*. When *initial-processes* is
nil or multiprocessing is
:with-tty-listener, a TTY listener process is started as well. The default value of multiprocessing is
Unchanged since previous save.
On the Macintosh, the value
t has the same effect as the value
At startup, if input and output are not redirected
At startup, even if input and output are redirected.
Unchanged since previous save.
Start with just the TTY listener.
Start the environment automatically, no TTY listener.
You should not try to save a new image over an existing one. Always save images using a unique image name, and then, if necessary, replace the new image with the old one after the call to
save-image has returned.
:multiprocessing nilalong with a true value of
:environment t. Multiprocessing is needed for the GUI environment.
load-imagechecks that load-all-patches has been called. If it is called before load-all-patches in a session then an error is signaled.
-buildcommand line argument, because LispWorks 6.1 and later versions call load-all-patches automatically. However, it does no harm for the build script to call load-all-patches too.
-initas the way to run LispWorks with a build script. This way is deprecated.
-build, whereas with
-inityou need to call quit explicitly at the end of the build script.
This example shows a portable build script which, on Cocoa, saves your new LispWorks image in a Mac OS X application bundle. This allows your new LispWorks for Macintosh image to be launchable from the Finder or Dock and to have its own icon or other resources:
LispWorks User Guide and Reference Manual - 20 Sep 2017