I'm trying to pass a large two-dimensional array of Byte to a C++ DLL, but keep getting illegal operations. Below is the code:
(Note: I need to pass it by reference because 1) it's very large and 2) I need the function to modify it.)

in the DLL:

Header:

extern "C" void __export Function (char**);

Program:

void __export Function (char** a) {

for (int x=0; x<=1000;x++)
for (int y=0;y<=1000;y++)
a[x][y]= // whatever calculations using a[x][y]

return;
}

--------

then in VB:

Declaration:
declare sub Function lib "whatever.dll" (byref a as any)

In code:
dim MyArray (0 to 999,0 to 999) as byte
'later...
Function MyArray (0,0)

-------

This code will work if the array is one-dimensional, but not two, so I must be doing something wrong, but I can't seem to find the error. I'd really appreciate any help on this one.

P.S. Another solution could be to make a one-dimensional array of pointers to one-dimensional arrays (i.e. char* a[1000]), but is that possible in VB???