1.靜態加載
procedure DOSomething; external 'MYLIB.DLL';
2.動態加載
usesWindows,……;
type
TTimeRec=record
Second:Integer;
Minute:Integer;
Hour:Integer;
end;
TGetTime=procedure(varTime:TTimeRec);
THandle=Integer;
var
Time:TTimeRec;
Handle:THandle;
GetTime:TGetTime; .
.
begin
Handle:=LoadLibrary('libraryname');
ifHandle<>0then
begin
@GetTime:=GetProcAddress(Handle,'GetTime');
if@GetTime<>nilthen
begin
GetTime(Time);
withTimedo
WriteLn('Thetimeis',Hour,':',Minute,':',Second);
end;
FreeLibrary(Handle);
end;
end;