Function
fli
allocate-foreign-object &key type pointer-type initial-element initial-contents nelems => pointer
An FLI type specifying the type of the object to be allocated. If type is supplied, pointer-type must not be supplied.
An 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 specifying how many copies of the object should be allocated. The default value is 1.
A pointer to the specified type or pointer-type.
allocate-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. Memory allocated in this manner must be explicitly freed usingfree-foreign-object
once the object is no longer needed. allocate-foreign-object
. Thedereference
function is then used to get the value thatpoint
points to.
(fli:define-c-typedef LONG :long) (setq point (fli:allocate-foreign-object :type 'LONG :initial-element 10)) (fli:dereference point)