DLL call... almost there

Good afternoon,

Finally, I’m able to be sure that my DLL is being called - the problem, I think, was the decorated names instead of undecorated.

Now, I face another problem: arrays. One of the parameters passed to my function (byref) is an array. Here’s the prototype of the function:

function calc(tjd : double;
i : Integer;
flag : Longint;
var xx : double;
var sErr : String
): Longint; cdecl; external “mydll.dll” name ‘calc’;

I’m trying to call it like:

function TestDLL(void): Longint;
S: String; 
xxy: array of double;
Result := calc2(2451545,1,1,xxy[0],S);      

I get the message that the variable is not an array - I think it refers to xxy. I tryed to define xxy like

xxy: array[0…5] of Double

but I get a syntax error in the []. Tryed [6],[0.5], etc…

What am I missing here?..

Kind regards,



I realize that if I call:

function TestDLL(void): Double;
S: String;
res: Longint;
xxy: double;
res := calc2(2451545,1,1,xxy,S);
Result := xxy;

I get the FIRST value of the DLL returned array.

Can’t figure how to get the others…



The scripting engine doesn’t handle var parameters in DLL functions, so it won’t work properly.
Try to update your DLL if you have access to its source code.