It is possible to pass arrays into and out of functions, but I'm afraid it's still kludgey.
With my array plug-in (part of my plug-in set), you can get pointers to array contents, and you can separate the pointer from the array and vice versa.
Here's an example that passes an array of integers containing the squares of 0 to 10 into a function, updates that arrays content within the function, and then adds a few more entries to the array. It then passes back the results:
dim a(10) as integer
` Put the square of the numbers 0 to 10 into the array
print "BEFORE:"
for i=0 to 10
a(i)=i*i
print i; " - "; a(i)
next i
print
` Get the array pointer and then unlink the array
ptr = get arrayptr( a() )
unlink array a()
` Call the function, expecting the array pointer to be returned
ptr = ProcessAllValues( ptr )
` Relink the array and pointer (it may be a different pointer if the array has changed size)
link array a(), ptr
print "AFTER:"
for i=0 to array count( a() )
print i; " - "; a(i)
next i
wait key
end
function ProcessAllValues(ArrayPtr as dword)
` Create an array, then link the array address onto it.
` This replaces the local array with the array passed in.
` You should ensure that the correct type of array is
` created if you wish to change values.
dim b() as integer
link array b(), ArrayPtr
` Change any values you want
for i = 0 to array count( b() )
b(i) = sqrt( b(i) )
next i
` Enlarge the array
array insert at bottom b()
b() = 101
array insert at bottom b()
b() = 102
` Finally unlink the array and pass back the array pointer.
` You have to unlink, or exiting the function could free the array
` as at this point, DBPro believes it's local to the function.
ArrayPtr = get arrayptr( b() )
unlink array b()
endfunction ArrayPtr
Bottom line - it's not nice to use, you have to get all steps right or else it'll crash, and personally, I don't use it very much at all.
But it's there if you want to use it.