xref@ arrayName( maxSub1 [
, maxSub2 ... ]
) [ as dataType ]
xref@ is identical to the xref statement, except that the link variable is interpreted as a handle, rather than as a pointer. You should use xref@ when you want the contents of a relocatable block to be treated as an array.
The following declares an array called
inclination, allocates a new block with enough room for
numElements elements, and associates the
inclination array with the contents of the block.
dim as long numElements : numElements = 5 // 5 is arbitrary
inclination = fn NewHandle( numElements * sizeof( long ) )
Note that, because the value of
maxSub1 is ignored in the xref@ statement, we can arbitrarily set it to 1. However, when we actually reference the elements of the
inclination array, we can specify any subscript value in the range 0 through
numElements - 1.