"CArray" (Compiled Type)
"CArray"::[type]
represents an array type compatible with C, containing elements of the specified type.
Details
Constructors
- Unless wrapped with "Managed", C arrays constructed with CreateTypeInstance are not automatically memory managed, and must be manually freed with DeleteObject. »
- CreateTypeInstance["CArray"::[type],len] constructs a C array with length len.
- CreateTypeInstance["CArray"::[type],carr,len] constructs a copy of the C array carr with length len.
- CreateTypeInstance["CArray"::[type],array] constructs a C array containing elements of the given array. Supported array types include "ListVector", "NumericArray" and "PackedArray".
- CreateTypeInstance["Managed"::["CArray"::[type]],…] constructs a memory-managed C array.
Properties
- Information[carr,"ElementType"] for carr of type "CArray"::[type] gives type .
- FromRawPointer[carr,offset] indexes the C array carr. Indexes start with 0.
Conversions
- Array types can be Cast to managed C arrays. Supported array types include "ListVector", "NumericArray" and "PackedArray".
- Cast can be used to bitcast C arrays to and from raw pointers.
Arrays
"RawPointer" and "OpaqueRawPointer"
Examples
open allclose allBasic Examples (2)
Possible Issues (1)
C arrays created outside of a "Managed" object are not automatically memory managed, and must be freed manually. Compile a function that creates unmanaged C arrays:
Use DeleteObject to manually free the C arrays: