Next: with-foreign-pointer, Previous: pointer-eq, Up: Pointers [Contents][Index]
bindings ::= {(var type &optional count)}*
A symbol.
A foreign type, evaluated.
An integer.
The macros with-foreign-object
and with-foreign-objects
bind var to a pointer to count newly allocated objects
of type type during body. The buffer has dynamic extent
and may be stack allocated if supported by the host Lisp.
CFFI> (with-foreign-object (array :int 10) (dotimes (i 10) (setf (mem-aref array :int i) (random 100))) (loop for i below 10 collect (mem-aref array :int i))) ⇒ (22 7 22 52 69 1 46 93 90 65)