The type of the elements of the array.
A sequence of the dimensions of the new array.
:c-array type converts between FLI arrays and the C array type. In C, pointers are used to access the elements of an array. The implementation of the
:c-array type takes this into account, by automatically dereferencing any pointers returned when accessing an array using foreign-aref.
When using the
:c-array type in the specification of an argument to define-foreign-function, a pointer to the array is passed to the foreign function, as specified by the C language. You are allowed to call the foreign function with a FLI pointer pointing to an object of type type instead of a FLI array.
When using the
:c-array type in other situations, it acts as an aggregate type like :foreign-array. In particular,
:c-array with more than one dimension is an array containing embedded arrays, not an array of pointers.
:c-arrayuses the C convention that the first index value of an array is
:c-arraytype when the corresponding C code uses an array with a constant declared size. If you need a dynamically sized array, then use a pointer type, allocate the array using the nelems argument to allocate-foreign-object or with-dynamic-foreign-objects and use dereference to access the elements. The pointer type is more efficient than making
:c-arraytypes dynamically with different dimensions because the FLI caches information about every different FLI type descriptor that is used.
LispWorks Foreign Language Interface User Guide and Reference Manual - 29 Sep 2017