* Added GetLoadErrorStr function by Mark Morgan Loyd (Bug ID 22321)

git-svn-id: trunk@21880 -
This commit is contained in:
michael 2012-07-11 15:31:09 +00:00
parent be8f8fec76
commit 8eeb22720b
7 changed files with 53 additions and 0 deletions

View File

@ -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

View File

@ -56,5 +56,11 @@ begin
Result:=false;
end;
Function GetLoadErrorStr: string;
begin
Result:='';
end;
{$endif}

View File

@ -53,5 +53,10 @@ begin
Result:=dlClose(Lib)=0;
end;
Function GetLoadErrorStr: string;
begin
Result:='';
end;
{$endif}

View File

@ -59,5 +59,10 @@ begin
Result := DosFreeModule (Lib) = 0;
end;
Function GetLoadErrorStr: string;
begin
Result:='';
end;
{$endif}

View File

@ -75,5 +75,11 @@ begin
Result:=dlClose(Lib)=0;
end;
Function GetLoadErrorStr: string;
begin
Result:=dl.dlerror;
end;
{$endif}

View File

@ -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}

View File

@ -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}