Macro
fli
with-coerced-pointer (binding-name &key type pointer-type) pointer &body body => last
A temporary name used to access a copy of pointer.
The type of the object pointed to by the temporary pointer. This keyword can be used to access the data at the pointer as a different type.
The pointer-type of the temporary pointer.
An FLI pointer of which a copy is made. The lifetime of the copy is across the scope of thewith-coerced-pointer
macro.
A list of forms to be executed across the scope of the temporary pointer binding.
The value of the last form in body.
with-coerced-pointer
makes a temporary copy of a pointer, and executes a list of forms which may use the copy across the scope of the macro. Once the macro has terminated the memory allocated to the copy of the pointer is automatically freed.
array-obj
. The macrowith-coerced-pointer
is used to return the values stored in the array, without alteringarray-obj
, or permanently tying up memory for a second pointer.
(setf array-obj (fli:allocate-foreign-object :type :int :nelems 10 :initial-contents '(0 1 2 3 4 5 6 7 8 9))) (fli:with-coerced-pointer (temp) array-obj (dotimes (x 10) (print (fli:dereference temp)) (fli:incf-pointer temp)))