A variable bound to 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.
A FLI pointer of which a copy is made. The lifetime of the copy is across the scope of the
A list of forms to be executed across the scope of the temporary pointer binding.
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.
If type is specified, then it must be a FLI type specifying the type that coerced-pointer points to. Alternatively, if pointer-type is specified, then it must be a FLI pointer type specifying the pointer type of coerced-pointer. If neither type nor pointer-type are specified then the type is the same as pointer.
You can use
with-coerced-pointer in a similar way to casting a pointer type in C. You can also use it make a temporary FLI pointer that can be changed using incf-pointer or decf-pointer, without affecting pointer.
In the following example an array of ten integers is defined, pointed to by
array-obj. The macro
with-coerced-pointer is used to return the values stored in the array, without altering
array-obj, or permanently tying up memory for a second pointer.
LispWorks Foreign Language Interface User Guide and Reference Manual - 16 Feb 2015