[Openmcl-devel] compilfing file with constant array of structs

Gary Byers gb at clozure.com
Tue Dec 17 08:24:01 PST 2002

On 17 Dec 2002, Marco Baringer wrote:

> i have a file which i can laod, but can't seem to compile....
> setup:
> in lal.lisp i define a struct (op-spec)
> in ass-const.lisp i define a constant [+constant-array+] containing an
> array of op-spec structs.
> in disassemble.lisp i have a function which references the array
> defined in ass-const.lisp [(aref +constant-array+ i)]. i can load
> disassemble.lisp just fine, but trying to compile it results in:
> > While executing: CCL::NO-MAKE-LOAD-FORM-FOR
> > Type :POP to abort.
> Type :? for other options.
> 1 >
> Does this make anysense? is this a problem with openmcl or a
> missunderstanding of mine reading how load and compile work?
> p.s. - if i concatenate ass-const.lisp and disassemble.lisp into one
> file and then load it i can sucessfully compile it.

There are sort of two issues here ("what does DEFCONSTANT do?" and
"what does it mean to refer to constants in compiled functions and
compiled files?").

Let's look at the second issue first (the first issue is thornier.)

Suppose we have:

;;; File ~/foo.lisp

(defstruct foo a b) ; a not-too insteresting structure

(defun reference-constant-array-of-foo-structures ()
  "Reference (return, in fact) a constant which contains instances
   of the FOO structure."
  #(#s(foo :A 1 :B 2) #s(foo :A 2 :B 1)))
;;; end-of-file ~/foo.lisp

? (compile-file "home:foo.lisp")
> Error in process listener(1): No MAKE-LOAD-FORM method is defined for #S(FOO :A 1 :B 2)
> While executing: NO-MAKE-LOAD-FORM-FOR
> Type :POP to abort.
Type :? for other options.

In this context, is it clear what the error message means ?

If it's not (or if it's not clear why COMPILE-FILE's behavior should differ
from other cases), section 3.2.4  goes into this in some depth.

The thornier issue has to do with whether or not this case:

;;; File ~/foo-1.lisp

(defstruct foo a b)

(defconstant constant-array-of-foo-structures
  (vector #s(foo :A 1 :B 2) #s(foo :A 2 :B 1)))

(defun reference-constant-array-of-foo-structures ()
  "Reference (return, in fact) a NAMED constant which contains instances
   of the FOO structure."       ;^^^^^

;;; end-of-file.~/foo-1.lisp

is or should be any different from the first case.  (I believe that
the correct answer is "maybe, depending on what DEFCONSTANT means in
a given implementation.")

OpenMCL actually offers some control over how DEFCONSTANT gets handled;
if that's the issue here, let me know and I'll try to remember how that
works ...

Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list