How can I pass an array to a Delphi DLL from Excel? I've read that u need to do it like this:
Delphi
Function Testing(MyArray:Array of Double; NoItems:Integer)ouble;stdcall;
begin
{somehow read the array and do something with it}
end;
Excel
Declare Function Testing Lib "ExcelTest" (ByRef MyArray as Double, ByVal NoItems as Integer)
Function Test(MyArray,NoItems)
ReDim MyTempArray(NoItems)
For a=1 to NoItems
MyTempArray(a-1)=MyArray(a-1)
Next a
Test = Testing(MyTempArray(0),NoItems)
End Function
This will put the array in sequential order in memory. You send only the first record. However, I can't get it to work. Excel locks up. Heeeeelp! What can I do? Any crum is valued dearly.
Delphi
Function Testing(MyArray:Array of Double; NoItems:Integer)ouble;stdcall;
begin
{somehow read the array and do something with it}
end;
Excel
Declare Function Testing Lib "ExcelTest" (ByRef MyArray as Double, ByVal NoItems as Integer)
Function Test(MyArray,NoItems)
ReDim MyTempArray(NoItems)
For a=1 to NoItems
MyTempArray(a-1)=MyArray(a-1)
Next a
Test = Testing(MyTempArray(0),NoItems)
End Function
This will put the array in sequential order in memory. You send only the first record. However, I can't get it to work. Excel locks up. Heeeeelp! What can I do? Any crum is valued dearly.