[cffi-devel] Problem with conc-name, dumping CFFI::AGGREGATE-STRUCT-SLOT

Andy Hefner ahefner at gmail.com
Sun May 24 06:03:04 UTC 2009


Compare the definitions of the structures WORKING and BROKEN:

(use-package :cffi)

(defcstruct foo
  (x :int))

(defcstruct working
  (y foo))

(defcstruct (broken :conc-name broken-)
  (y foo))

Compiling the WORKING definition works perfectly, while compiling
BROKEN produces the following error in SBCL:

; caught ERROR:
;   don't know how to dump #<CFFI::AGGREGATE-STRUCT-SLOT {10041256D1}>
(default MAKE-LOAD-FORM method called).

This appears to stem from the application of the following compiler
macro (and ultimately the result of foreign-struct-slot-set-form) to
the generated accessors:

(define-compiler-macro foreign-slot-set
    (&whole form value ptr type slot-name)
  "Optimizer when TYPE and SLOT-NAME are constant."
  (if (and (constantp type) (constantp slot-name))
      (foreign-struct-slot-set-form
       value ptr (get-slot-info (eval type) (eval slot-name)))
      form))

This occurs for arrays as well as structures for the slot type, but
not simpler types (:int, etc).




More information about the cffi-devel mailing list