jlaurin
asked on
How to resolve PSafeArray from dll
I have a dll wrapping a webservice call (C#.net).
When I import the library to Delphi, the return type changes to PSafeArray.
Here's the signature from the TLB:
procedure GetNumberRange(const connString: WideString; const nameCaller: WideString;
identCaller: Integer; const orderRef: WideString; countryCode: Word;
quantity: LongWord; oneRange: WordBool; numbers: PSafeArray); safecall;
Here's my call from Delphi (Same as an exmple I got here):
a: Variant;
begin
bnds[0].LowBound := 0;
bnds[0].ElementCount := 0;
ws := CoResETag.Create();
psa := SafeArrayCreate(varOLEStr, 1,bnds);
try
ws.GetNumberRange(tbConnSt ring.Text, tbNameCall er.Text,St rToInt(tbI dentCaller .Text),tbO rderRef.Te xt, StrToInt(tbCountryCode.Tex t), StrToInt(tbQuantity.Text), true, psa);
/****/
I get: Specified array was not of the expecting type when executing this.
Help please
When I import the library to Delphi, the return type changes to PSafeArray.
Here's the signature from the TLB:
procedure GetNumberRange(const connString: WideString; const nameCaller: WideString;
identCaller: Integer; const orderRef: WideString; countryCode: Word;
quantity: LongWord; oneRange: WordBool; numbers: PSafeArray); safecall;
Here's my call from Delphi (Same as an exmple I got here):
a: Variant;
begin
bnds[0].LowBound := 0;
bnds[0].ElementCount := 0;
ws := CoResETag.Create();
psa := SafeArrayCreate(varOLEStr,
try
ws.GetNumberRange(tbConnSt
/****/
I get: Specified array was not of the expecting type when executing this.
Help please
ASKER
Nope. Still getting the same error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
var bound: TSafeArrayBound;
sa: PSafeArray;
bound.lLbound := 0;
bound.cElements := 5;
sa := SafeArrayCreate(varVariant
ziolko.