aglAlloc

Allocates a block of memory with a fixed shape.

int aglAlloc(
  pvoid dims,
  int numdims,
  int datatype,
  );

Parameters

dims
A pointer to an array of Integers. The size of dims must be equal to numdims. The dims array specifies the dimensions of the array to be allocated.

numdims
The number of dimensions (at most 7) of the array.

datatype
The type of the data in the array, as shown in the following table. You can use the name on the left as a substitute for the number on the right.

Data Type Code
AGL_UCHAR 4096
AGL_CHAR 4097
AGL_USHORT 4098
AGL_SHORT 4099
AGL_ULONG 4100
AGL_LONG 4101
AGL_FLOAT 4102
AGL_DOUBLE 4103
AGL_ULLONG 4104
AGL_LLONG 4105

Return Value

Returns a pointer to the allocated block of memory, or NULL if aglAlloc was unable to allocate the memory.

Remarks

Unlike aglMalloc, aglAlloc allocates a block of memory using arrays of pointers. This means that you can refer to multi-dimensional array elements using bracket notation rather than pointer arithmetic; for example: M[i][j] rather than M[i*NumberOfCols + j]. You should eventually deallocate the memory by calling aglFree.

Note: aglReshape cannot be used with this memory block to modify the array shape.

See Also

aglMalloc