Forum > General

AV - and DLL

(1/1)

tomek:
This is my code of dll usage:

--- Code: ---implementation
procedure proced_(var i:Real); stdcall; external 'libo3.dll';
...
procedure TForm1.Button1Click(Sender: TObject);
var
  r:Real;
begin
  r:=6;
  proced_(r);
  Label1.Caption:=FloatToStr(r);
end;
--- End code ---

procedure "proced_" in dll changes the value of r, and r on label is correct, but at end of Button1Click I get AV in TControlClick - include/control.inc

I forgot something in calling to the library?

marcov:

--- Quote from: tomek on March 08, 2011, 09:48:40 am ---This is my code of dll usage:

--- Code: ---implementation
procedure proced_(var i:Real); stdcall; external 'libo3.dll';
...
procedure TForm1.Button1Click(Sender: TObject);
var
  r:Real;
begin
  r:=6;
  proced_(r);
  Label1.Caption:=FloatToStr(r);
end;
--- End code ---

procedure "proced_" in dll changes the value of r, and r on label is correct, but at end of Button1Click I get AV in TControlClick - include/control.inc

I forgot something in calling to the library?

--- End quote ---

No, but maybe it is not stdcall, but e.g. cdecl?

tomek:

--- Quote from: marcov on March 08, 2011, 09:56:34 am ---No, but maybe it is not stdcall, but e.g. cdecl?

--- End quote ---

Thanks, with cdecl is ok.
But I wonder why that because library was compiled as stdcall calling convention.
This is fortran g95 "g95 -shared -mrtd -o libo3.dll libo3.o" - mrtd sets to stdcall calling convention.
In any case, work ok with cdecl. Thanks for help.

Leledumbo:

--- Quote ---This is fortran g95 "g95 -shared -mrtd -o libo3.dll libo3.o" - mrtd sets to stdcall calling convention.
--- End quote ---
Well for that you should ask in g95 forum.

Navigation

[0] Message Index

Go to full version