can't access array of enums in struct slot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
New
|
Undecided
|
Unassigned |
Bug Description
(cffi:defcenum (foo :unsigned-int))
(cffi:defcstruct bar
(f :unsigned-int :count 2)
(f2 foo :count 2))
(cffi:with-
(print (cffi:foreign-
=>
#.(SB-SYS:INT-SAP #X7FFFD68CFFE8)
(cffi:with-
(print (cffi:foreign-
=>
The value of CFFI::VALUE is #.(SB-SYS:INT-SAP #X7FFFD68CFFF0), which is not of type INTEGER.
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1003B765A3}>
0: (SB-KERNEL:
1: (CFFI::
2: ((LAMBDA ()))
expected a pointer or sequence of enum keywords
tested on sbcl 1.2.13.2 linux x8664, cffi from dec 2014, and sbcl 1.2.13.48 windows x8664, cffi a bit past v0.15
shouldn't it be written something like:
(cffi:with- foreign- object (p '(:struct bar))
(print (mem-ref p 'foo (foreign- slot-offset '(:struct bar) 'f2))))
i think the given example is a violation of the CFFI API... or is it not?