mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 05:59:28 +02:00
* Added GetLoadErrorStr function by Mark Morgan Loyd (Bug ID 22321)
git-svn-id: trunk@21880 -
This commit is contained in:
parent
be8f8fec76
commit
8eeb22720b
@ -37,6 +37,7 @@ Function SafeLoadLibrary(const Name : AnsiString) : TLibHandle;
|
||||
Function LoadLibrary(const Name : AnsiString) : TLibHandle;
|
||||
Function GetProcedureAddress(Lib : TlibHandle; const ProcName : AnsiString) : Pointer;
|
||||
Function UnloadLibrary(Lib : TLibHandle) : Boolean;
|
||||
Function GetLoadErrorStr: string;
|
||||
|
||||
// Kylix/Delphi compability
|
||||
|
||||
|
@ -56,5 +56,11 @@ begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
|
||||
Function GetLoadErrorStr: string;
|
||||
|
||||
begin
|
||||
Result:='';
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
@ -53,5 +53,10 @@ begin
|
||||
Result:=dlClose(Lib)=0;
|
||||
end;
|
||||
|
||||
Function GetLoadErrorStr: string;
|
||||
|
||||
begin
|
||||
Result:='';
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
@ -59,5 +59,10 @@ begin
|
||||
Result := DosFreeModule (Lib) = 0;
|
||||
end;
|
||||
|
||||
Function GetLoadErrorStr: string;
|
||||
|
||||
begin
|
||||
Result:='';
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
@ -75,5 +75,11 @@ begin
|
||||
Result:=dlClose(Lib)=0;
|
||||
end;
|
||||
|
||||
Function GetLoadErrorStr: string;
|
||||
|
||||
begin
|
||||
Result:=dl.dlerror;
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
|
||||
|
@ -54,5 +54,20 @@ begin
|
||||
Result:=Windows.FreeLibrary(Lib);
|
||||
end;
|
||||
|
||||
Function GetLoadErrorStr: string;
|
||||
|
||||
Var
|
||||
rc : integer;
|
||||
begin
|
||||
rc := GetLastError;
|
||||
try
|
||||
result := Trim(SysErrorMessage(rc));
|
||||
if (result='') then
|
||||
result := 'Operating system error 0x' + IntToHex(rc, 8) + ' (no descriptive text)'
|
||||
except
|
||||
result := 'Operating system error 0x' + IntToHex(rc, 8) + ' (error getting descriptive text)'
|
||||
end;
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
|
||||
|
@ -59,4 +59,19 @@ begin
|
||||
Result:=Windows.FreeLibrary(Lib);
|
||||
end;
|
||||
|
||||
Function GetLoadErrorStr: string;
|
||||
|
||||
Var
|
||||
rc : integer;
|
||||
begin
|
||||
rc := GetLastError;
|
||||
try
|
||||
result := Trim(SysErrorMessage(rc));
|
||||
if (result='') then
|
||||
result := 'Operating system error 0x' + IntToHex(rc, 8) + ' (no descriptive text)'
|
||||
except
|
||||
result := 'Operating system error 0x' + IntToHex(rc, 8) + ' (error getting descriptive text)'
|
||||
end;
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
|
Loading…
Reference in New Issue
Block a user