malloc-array ( n c-type -- array )


Vocabulary
alien.data

Inputs
na non-negative integer
c-typea C type


Outputs
arraya specialized array


Word description
Allocates an unmanaged memory block large enough to hold n values of a C type, then wraps the memory in a sequence object using <c-direct-array>.

Notes
The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the specialized-arrays vocabulary for details on the underlying sequence type constructed.

Warning
Don't forget to deallocate the memory with a call to free.


Errors
Throws an error if the type does not exist, if the requested size is negative, if a direct specialized array class appropriate to the type is not loaded, or if memory allocation fails.

See also
<c-array>, <c-direct-array>

Definition