have a function, simplified below, that is exported from a BPL
function DoA(amount: currency; var Info: string): Currency; stdcall;
begin
result := amount * 19;
Info:= 'Some Text about the result';
end;
its loaded from the main program with LoadPackage, and GetProcAddress which works fine for the other functions. but this one brings up many errors when its called;
BPL Is used with (simplified)
bplhandle: HModule;
BPLDoA: function (amount: currency; var Info: string): Currency; stdcall;
intoStr : string;
.
begin
bplhandle:=LoadPackage('test.bpl');
if bplhandle <> 0 then
begin
@BPLDoA:=GetProcAddress(bplhandle,'DoA');
if assigned(BPLDoA) then
result := BPLDoA(123, intoStr);
end;
end;
the exception that seems to happen at the end of the Procedure, but the corrected text is returned into intoStr (viewed with a break point)
would the error have anything to do with the Info param being a var and/or a string?
The Error message is
Project Project1.exe raised exception class EInvalidPointer with message 'Invalid pointer operation'
thanks
more info> another function from the same bpl/unit works fine
function DoB(amount: currency): Currency; stdcall;
result := amount * 19;
end;
Mad Except>
exception class : EInvalidPointer exception message : Invalid pointer operation.
main thread ($1b7c): 0040276f +013 Project1.exe System @FreeMem 00404650 +01c Project1.exe System @LStrClr 00483814 +15c Project1.exe Unit1 97 +11 TForm1.Button3Click 00462430 +064 Project1.exe Controls TControl.Click 0045a870 +01c Project1.exe StdCtrls TButton.Click