Hi Tao,
you mean a C Dll you wanna use with:
DECLARE INTEGER yourFunction IN yourDll INTEGER ...
you have to assemble the array in memory yourself ...
e.g. the C function is similar to this one:
int theFunction(int passedArray[], int lnLen)
{
int lnRetVal = 0;
int xj;
for(xj=0;xj {
lnRetVal = lnRetVal + theParameter[xj];
}
return lnRetVal;
}
you can do in FoxPro ..
&& you need clsheap.prg .. look in the download area if you don't have it ..
SET PROCEDURE TO clsheap.prg additive
&& Create a dummy array
DIMENSION laInts[20]
FOR xj = 1 TO ALEN(laInts)
laInts[xj] = xj
ENDFOR
&&then you have to create a string which would look like the C int Array in &&memory ..
lcArray = ''
FOR xj = 1 TO ALEN(laInts)
lcArray = lcArray + NumToDWORD(laInts[xj]) && NumToDWORD -> clsheap.prg
ENDFOR
&&now create a Heap object and put the string on the heap, whichs returns us &&a pointer to it ..
oHeap = CREATE('Heap')
lnPointerToArray = oHeap.AllocBlob(lcArray)
&&finally call your function ... e.g.
theFunction(lnPointerToArray,20)
that's it ..
Regards
Christian