G
ghbh
Unregistered / Unconfirmed
GUEST, unregistred user!
动态链接库:
library Project1;
uses
ShareMem,
SysUtils,
Classes;
{$R *.res}
function aa(a, b: integer):integer;stdcall;
begin
Result := a + b;
end;
exports aa name 'aa';
begin
end.
调用
procedure TForm1.Button1Click(Sender: TObject);
var aa:function(a,b:integer):integer;stdcall;
hlib:THandle;
b:integer;
begin
hlib := LoadLibrary('Project1.dll');
@aa := GetProcAddress(hlib,'aa');
b := aa(1,2);
Showmessage(IntToStr(b));
FreeLibrary(hlib);
end;
调用完执行FreeLibrary(hlib)后出现内存错误。在win98下运行正常。为什么?
library Project1;
uses
ShareMem,
SysUtils,
Classes;
{$R *.res}
function aa(a, b: integer):integer;stdcall;
begin
Result := a + b;
end;
exports aa name 'aa';
begin
end.
调用
procedure TForm1.Button1Click(Sender: TObject);
var aa:function(a,b:integer):integer;stdcall;
hlib:THandle;
b:integer;
begin
hlib := LoadLibrary('Project1.dll');
@aa := GetProcAddress(hlib,'aa');
b := aa(1,2);
Showmessage(IntToStr(b));
FreeLibrary(hlib);
end;
调用完执行FreeLibrary(hlib)后出现内存错误。在win98下运行正常。为什么?