All Manuals > LispWorks User Guide and Reference Manual > 32 The HCL Package

NextPrevUpTopContentsIndex

dump-forms-to-file

Function
Summary

Dumps specified forms to a fasl file.

Package

hcl

Signature

dump-forms-to-file pathname forms => nil

Arguments

pathname

Name of the fasl file to be created.

forms

Forms to be dumped.

Values

Returns nil .

Description

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:

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 .

Example
(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"))
See also

*binary-file-type*
*binary-file-types*
with-output-to-fasl-file


LispWorks User Guide and Reference Manual - 21 Dec 2011

NextPrevUpTopContentsIndex