A list of foreign slot names slot-name for object .
A foreign structure or a pointer to a foreign structure.
A list of forms to be executed.
The macro
with-foreign-slots
is analogous to the Common Lisp macro
with-slots
. Within
body
, each
slot-name
evaluates to the result of foreign-slot-value, and
setf
can be used to set the foreign-slot-value.
(fli:define-c-struct abc
(a :int)
(b :int)
(c :int))
=>
(:STRUCT ABC)
(setf abc (fli:allocate-foreign-object :type 'abc))
=>
#<Pointer to type (:STRUCT ABC) = #x007F3BE0>
(fli:with-foreign-slots (a b c) abc
(setf a 6 b 7 c (* a b)))
=>
42
(fli:foreign-slot-value abc 'c)
=>
42