.lib文件Delphi用不了 .h需要改写成.pas .dll分静态调用和动态调用两种 静态调用:procedure DoSomething; external 'MYLIB.DLL'; 动态调用: var hIns: HWnd; p : procedure(); stdcall; begin hIns := LoadLibrary('C:\test.dll'); if hIns <> 0 then begin p := GetProcAddress(hIns, 'DoSomething'); if Assigned(p) then p(); end; FreeLibrary(hIns); end;
.h需要改写成.pas
.dll分静态调用和动态调用两种
静态调用:procedure DoSomething; external 'MYLIB.DLL';
动态调用:
var
hIns: HWnd;
p : procedure(); stdcall;
begin
hIns := LoadLibrary('C:\test.dll');
if hIns <> 0 then
begin
p := GetProcAddress(hIns, 'DoSomething');
if Assigned(p) then
p();
end;
FreeLibrary(hIns);
end;