12 lines
622 B
Plaintext
12 lines
622 B
Plaintext
function getdlsymaddress(lib,n); //获取动态库中的函数句柄
|
|
begin
|
|
if not(ifstring(lib) and lib and n and ifstring(n)) then return 0;
|
|
{$ifdef linux}
|
|
Return dlsym(dlopen(lib,0x101) ,n);
|
|
{$endif}
|
|
Return GetProcAddress(LoadLibraryA(lib),n);
|
|
end
|
|
function dlopen(dl:string;flg:integer):pointer;cdecl ;external "libdl.so.2";
|
|
function dlsym(handle:pointer;symbol:string):pointer;cdecl ;external "libdl.so.2";
|
|
function LoadLibraryA(txt:string):POINTER;stdcall;external "Kernel32.dll" name "LoadLibraryA";
|
|
function GetProcAddress(h:pointer;n:string):pointer;stdcall;external "Kernel32.dll" name "GetProcAddress"; |