| Allegro CL version 6.2 Unrevised from 6.1 |
Arguments: type &optional allocation size
Allocate an object of the given type in heap described by the allocation argument. If the size argument is given, then it is the minimum size (in bytes) of the data portion of the object that will be allocated. The valid allocation argument values are as follows (default is :foreign). type should be a type defined with def-foreign-type
.aclmalloc
). Unlike other objects allocated in
static space, these objects are automatically gc'ed (the C
aclfree
function is called on them) when the
last pointer to them in the Lisp heap disappears. The advantage of
this allocation type over :foreign
is that the
object doesn't move. This makes it very useful when the object
must be passed to a C foreign-function that releases the heap
(e.g. most functions in the Windows package). :lisp
and then call
read-sequence
to read the data from the binary file into
the foreign object. Note, however, that
read-sequence
will also work for :foreign
allocated
objects.
There is one tricky case for 32-bit Lisps (it is not an issue on 64-bit Lisps): if the foreign structure requires 8 byte alignment (e.g. it begins with a double float) then the first four bytes of the lisp array allocated will not be used by fslot-value-typed. If you read-sequence into such an array, then your data will be displaced 4 bytes from where fslot-value-typed thinks it is.
:aligned
- This is just like
:c
except that it returns
an aligned pointer.See ftype.htm for information on foreign types in Allegro CL and foreign-functions.htm for general information on foreign functions in Allegro CL.
Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page was not revised from the 6.1 page.
Created 2002.2.26.
| Allegro CL version 6.2 Unrevised from 6.1 |