delphi 调用动态连接库DEMO
1、在被调用的dll中exports函数,pas文件定义声明函数;
2、需要调用的地方加上
Handle := GetModuleHandle(PChar(DLL));
if Handle = 0 then
begin
Handle := LoadLibrary(PChar(DLL));
if Handle = 0 then
begin
AppMessageBox('加载DLL文件<'+DLL+'>失败',2);
Exit;
end;
end;
@CapitalDLLFunc := GetProcAddress(Handle, PChar('PrintReport'));
if @CapitalDLLFunc <> nil then