Futurebasic/Language/Reference/xref

Syntax
XREF arrayName maxSub1 maxSub2 AS dataType

Description
The  statement declares an array, and associates the array with the memory pointed to by a particular long-integer variable, called the "link variable." You can use  to cause any arbitrary block of memory to be treated as an array. This is especially useful when you need to dynamically create an array whose size can't be determined until runtime, or when you want to impose an array structure on data that was created outside of your FB program.

The link variable must be a simple (non-array, non-field) long-integer variable which has the same name as the array (ignoring any type-identifier suffix). For example, if you specify the following:

The compiler creates a long-integer variable called. When you run the program, you should set  equal to some appropriate memory address (you do this after the   statement); FB then assumes that the   array begins at that address. When you examine elements in the array, they are retrieved from the memory pointed to by. When you alter elements in the array, the memory pointed to by  is altered.

The first subscript is arbitrary The,   etc. values must be positive static integer expressions. However, since  does not actually allocate any memory, the declared subscripts are used somewhat differently than in a   statement. The second and subsequent subscripts (if any) determine the internal structure of the array, and they should exactly match the internal layout of the elements pointed to by the link variable. But the value of the first subscript is basically ignored, and may be arbitrarily set to any value greater than zero. When you actually reference the array elements, you can use subscript values that are larger than, as long as they reference valid elements within the block of memory pointed to by the link variable.