/*Hi folks!*/
Is there a way to get the (meta) information of structure slots defined by */defcstruct/*?
Consider the following concrete example:
(defcstruct test (a :uint) (b :char :count 10) (c :pointer))
Is it possible to get info like type, (array-)size of the slots /*a, b* /and /*c*/ by only introspecting '/*test*/'? Something like
(foreign-slot-type 'test 'a) /*==> :char*/ (foreign-slot-count 'test 'b) /*==> 10*/
would be very useful!
Regards Nik
On Thu, Apr 14, 2011 at 3:47 PM, nitralime nitralime@googlemail.com wrote:
Is there a way to get the (meta) information of structure slots defined by defcstruct?
There isn't an exported interface, but you can get the slot info object with (cffi::get-slot-info 'struct-name 'slot-name) then peek its slots. See src/types.lisp and have a look at class FOREIGN-STRUCT-SLOT, its subclasses, and its accessors.
HTH,