I've created a DLL in Delphi that has to receive among other parameters, an array of strings from Visual Fox Pro.
I've tried different ways to send the data, but usually what i get is a "Declare DLL call caused an exception", and I'm not sure if the problem is the type of variable I'm sending on VFP or the type I'm receiving on Delphi.
We've tried sending an array of strings from VFP
Local arString[3]
arString[1] = 'Text1'
arString[2] = 'Text2'
arString[3] = 'Text3'
Declare integer callDLL in (dllfile) string, string, string
CallDLL('firstvar', 'secondvar', arString)
and on Delphi:
type Str: Array[1..3] of string;
function CallDLL(firstvar, secondvar: PAnsiChar; S: Str):Integer; stdcall ;
begin
ShowMessage(S[0]) ;
...
end;
exports CallDLL ;
Before I added the array of strings, the DLL worked correctly, so it's not the overall construction of the other parameters.
Any idea of what I'm doing wrong?
Thanks, TZ
It seemsthere is no array type parameter available, so you will most probably need to concatenate those strings on the FoxPro side and parse them on the Delphi side. Also, you have declared that the function will return an integer, whilst on the Delphi side you don't return anything.