co-task-mem-alloc &key
type
pointer-type
initial-element
initial-contents nelems
=>
pointer
A foreign type specifying the type of the object to be allocated. If type is supplied, pointer-type must not be supplied.
A foreign 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 specifying how many copies of the object should be allocated. The default value is 1.
The function
co-task-mem-alloc
calls the C function
CoTaskMemAlloc()
to allocate a block of memory. The various arguments are handled in the same way as for the function
fli:allocate-foreign-object
(see the
LispWorks Foreign Language Interface User Guide and Reference Manual
).
Two ways to allocate memory for an integer:
(co-task-mem-alloc :type :int)
(co-task-mem-alloc :pointer-type '(:pointer :int))