dump-forms-to-file
dumps specified forms to a fasl file. Use the Common Lisp functions
make-load-form
and
make-load-form-saving-slots
to control the dumping of forms.
To be able to load the output file, it must have a file type that LispWorks recognizes as a binary file. You can do it by:
compile-file-pathname
as in the example below.If the file pathname already exists, it is superseded.
A fasl file created using
dump-forms-to-file
must be loaded only by load-data-file, and not by
load
.
(defclass my-class () ((a :initarg :a :accessor my-a)))
(defmethod make-load-form ((self my-class) &optional environment)
(declare (ignore environment))
`(make-instance ',(class-name (class-of self))
:a ',(my-a self)))
(setq *my-instance* (make-instance 'my-class :a 42))
(dump-forms-to-file
(compile-file-pathname "my-instance")
(list `(setq *my-instance* ,*my-instance*)))
In another session, with the same definition of
my-class
, loading the file
"my-instance"
using load-data-file will create an equivalent instance of
my-class
:
(sys:load-data-file
(compile-file-pathname "my-instance"))
LispWorks User Guide and Reference Manual - 21 Dec 2011