mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:09:19 +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 LoadLibrary(const Name : AnsiString) : TLibHandle;
|
||||||
Function GetProcedureAddress(Lib : TlibHandle; const ProcName : AnsiString) : Pointer;
|
Function GetProcedureAddress(Lib : TlibHandle; const ProcName : AnsiString) : Pointer;
|
||||||
Function UnloadLibrary(Lib : TLibHandle) : Boolean;
|
Function UnloadLibrary(Lib : TLibHandle) : Boolean;
|
||||||
|
Function GetLoadErrorStr: string;
|
||||||
|
|
||||||
// Kylix/Delphi compability
|
// Kylix/Delphi compability
|
||||||
|
|
||||||
|
@ -56,5 +56,11 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Function GetLoadErrorStr: string;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
@ -53,5 +53,10 @@ begin
|
|||||||
Result:=dlClose(Lib)=0;
|
Result:=dlClose(Lib)=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function GetLoadErrorStr: string;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
@ -59,5 +59,10 @@ begin
|
|||||||
Result := DosFreeModule (Lib) = 0;
|
Result := DosFreeModule (Lib) = 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function GetLoadErrorStr: string;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
@ -75,5 +75,11 @@ begin
|
|||||||
Result:=dlClose(Lib)=0;
|
Result:=dlClose(Lib)=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function GetLoadErrorStr: string;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=dl.dlerror;
|
||||||
|
end;
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
@ -54,5 +54,20 @@ begin
|
|||||||
Result:=Windows.FreeLibrary(Lib);
|
Result:=Windows.FreeLibrary(Lib);
|
||||||
end;
|
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}
|
{$endif}
|
||||||
|
|
||||||
|
@ -59,4 +59,19 @@ begin
|
|||||||
Result:=Windows.FreeLibrary(Lib);
|
Result:=Windows.FreeLibrary(Lib);
|
||||||
end;
|
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}
|
{$endif}
|
||||||
|
Loading…
Reference in New Issue
Block a user