Description
EAlloc() is used to allocate a new block of memory.
Call Signature
any ptr EAlloc ( identifier type_name, int elements )
Return Value
any ptr
Pointer to a block of memory.
Arguments
identifier type_name:
The name of the type of data to be allocated. This can be any basic type or user defined type. The identifier for the type is passed, not a string containing the name.
int elements:
The number of the above items to allocate.
Remarks
The resulting pointer may be assigned to a pointer variable. The newly allocated block of memory is not necessarily zeroed. The memory block is allocated with the C routine HMalloc().
Example
The following example allocates 200 integers and then zeros the array before using it. This code is approximately equivalent to a variable declaration of "local integer array[100]". Note that F$LEN() can be used to determine the size of an array, and that the type_name is just the type identifier, not a string.
local integer ptr array, integer i
array = EAlloc( int, 200 )
for i = 1 to F$LEN(array)
array[i] = 0
endfor
See also
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.