Allocates memory for an instance of a foreign object within the scope of a with-dynamic-foreign-objects macro.
allocate-dynamic-foreign-object &key type pointer-type initial-element initial-contents fill nelems size-slot => pointer
A FLI type specifying the type of the object to be allocated. If type is supplied, pointer-type must not be supplied.
A FLI pointer type specifying the type of the pointer object to be allocated. If pointer-type is supplied, type must not be supplied.
A keyword setting the initial value of every element in the newly allocated object to initial-element .
A list of forms which initialize the contents of each element in the newly allocated object.
An integer between 0 to 255.
An integer specifying how many copies of the object should be allocated. The default value is 1.
A symbol naming a slot in the object.
The function
allocate-dynamic-foreign-object
allocates memory for a new instance of an object of type
type
or an instance of a pointer object of type
pointer-type
within the scope of the body of the macro with-dynamic-foreign-objects.
The object is initialized as if by allocate-foreign-object.
Once this macro has executed, the memory allocated using
allocate-dynamic-foreign-object
is therefore automatically freed for other uses.
A full example using with-dynamic-foreign-objects and
allocate-dynamic-foreign-object
is given in An example of dynamic memory allocation.
allocate-foreign-object
with-dynamic-foreign-objects
An example of dynamic memory allocation
More examples of allocation and pointer allocation
LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011