静态:function MyFunction(..): type stdcall; external 'DLLName.dll';
动态:
type
TOleRegisterFunction = function : HResult;
...
hLibraryHandle := LoadLibrary(PCHAR(strOleFileName));
if (hLibraryHandle > 0) then try
if (OleAction = RegisterOle) then hFunctionAddress := GetProcAddress(hLibraryHandle, pchar('DllRegisterServer'))
else hFunctionAddress := GetProcAddress(hLibraryHandle, pchar('DllUnregisterServer'));
if (hFunctionAddress <> NIL) then begin
RegFunction := TOleRegisterFunction(hFunctionAddress); if RegFunction >= 0 then result := true;
end;
finally
FreeLibrary(hLibraryHandle);
end;