defctype and inner structs do not seem to play nicely
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
New
|
Undecided
|
Unassigned |
Bug Description
With the attached code, the following transcript shows the difference:
CL-USER> (ql:quickload "CFFI")
To load "cffi":
Load 1 ASDF system:
cffi
; Loading "cffi"
..
("CFFI")
CL-USER> (use-package "CFFI")
T
CL-USER> (load "/Users/
STYLE-WARNING: Undefined alien: "get_outer"
T
CL-USER> (setup)
#<FOREIGN-LIBRARY CFFI.O-943 "cffi.o">
CL-USER> (get-outer-works)
"Outer Translated, a = 1, b= <Inner Translated, a = 2, b= 3>"
CL-USER> (get-outer-bug)
"Outer Translated, a = 1, b= <#.(SB-SYS:INT-SAP #X0018E004)>"
The difference in the result is that in '(get-outer-works)' the inner struct is translated and
in the bug version it is not.
As far as I can tell the only relevant difference is in the declaration of the outer structs:
(defcstruct (outer-struct :class outer-struct-type)
(a :int)
(b (:struct inner-struct)))
vs
(defctype %bug-struct (:struct inner-struct))
(defcstruct (outer-struct-bug :class outer-struct-
(a :int)
(b %bug-struct))