mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 18:49:16 +02:00
* Changed library-initialisation. It now works the same as for mysql. Fixes bug #9546
git-svn-id: trunk@8753 -
This commit is contained in:
parent
a701dab36c
commit
d40293b7fb
@ -2428,8 +2428,9 @@ var
|
|||||||
isc_suspend_window : function (_para1:PISC_STATUS; _para2:Pisc_win_handle):ISC_STATUS; extdecl;
|
isc_suspend_window : function (_para1:PISC_STATUS; _para2:Pisc_win_handle):ISC_STATUS; extdecl;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
Procedure InitialiseIBase60;
|
function InitialiseIBase60(Const LibraryName : String) : integer;
|
||||||
Procedure ReleaseIBase60;
|
function InitialiseIBase60 : integer;
|
||||||
|
procedure ReleaseIBase60;
|
||||||
|
|
||||||
var IBaseLibraryHandle : TLibHandle;
|
var IBaseLibraryHandle : TLibHandle;
|
||||||
|
|
||||||
@ -2449,15 +2450,14 @@ var
|
|||||||
RefCount : integer;
|
RefCount : integer;
|
||||||
LoadedLibrary : String;
|
LoadedLibrary : String;
|
||||||
|
|
||||||
Function TryInitialiseIBase60(Const LibraryName : String) : Boolean;
|
Function TryInitialiseIBase60(Const LibraryName : String) : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=False;
|
Result := 0;
|
||||||
if (RefCount=0) then
|
if (RefCount=0) then
|
||||||
begin
|
begin
|
||||||
IBaseLibraryHandle:=LoadLibrary(LibraryName);
|
IBaseLibraryHandle:=LoadLibrary(LibraryName);
|
||||||
Result:=(IBaseLibraryHandle<>nilhandle);
|
if (IBaseLibraryHandle=nilhandle) then
|
||||||
If not Result then
|
|
||||||
Exit;
|
Exit;
|
||||||
inc(RefCount);
|
inc(RefCount);
|
||||||
LoadedLibrary:=LibraryName;
|
LoadedLibrary:=LibraryName;
|
||||||
@ -2630,35 +2630,40 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
|
||||||
If (LoadedLibrary<>LibraryName) then
|
|
||||||
Raise EInoutError.CreateFmt(SErrAlreadyLoaded,[LoadedLibrary]);
|
|
||||||
inc(RefCount);
|
inc(RefCount);
|
||||||
Result:=True;
|
Result := RefCount;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure InitialiseIBase60;
|
function InitialiseIBase60 : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Result := 0;
|
||||||
If UseEmbeddedFirebird then
|
If UseEmbeddedFirebird then
|
||||||
begin
|
begin
|
||||||
If Not TryInitialiseIBase60(fbembedlib) then
|
If (TryInitialiseIBase60(fbembedlib)=0) then
|
||||||
Raise EInOutError.CreateFmt(SErrEmbeddedFailed,[fbembedlib]);
|
Raise EInOutError.CreateFmt(SErrEmbeddedFailed,[fbembedlib]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
If (Not TryInitialiseIBase60(fbclib)) and
|
If (TryInitialiseIBase60(fbclib)=0) and
|
||||||
(Not TryInitialiseIBase60(gdslib)) then
|
(TryInitialiseIBase60(gdslib)=0) then
|
||||||
Raise EInOutError.CreateFmt(SErrDefaultsFailed,[gdslib,fbclib]);
|
Raise EInOutError.CreateFmt(SErrDefaultsFailed,[gdslib,fbclib]);
|
||||||
end;
|
end;
|
||||||
|
Result := RefCount;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure InitialiseIBase60(Const LibraryName : String);
|
function InitialiseIBase60(Const LibraryName : String) : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If Not TryInitialiseIbase60(LibraryName) then
|
Result := TryInitialiseIBase60(LibraryName);
|
||||||
Raise EInOutError.CreateFmt(SErrLoadFailed,[LibraryName]);
|
If Result = 0 then
|
||||||
|
Raise EInOutError.CreateFmt(SErrLoadFailed,[LibraryName])
|
||||||
|
else If (LibraryName<>LoadedLibrary) then
|
||||||
|
begin
|
||||||
|
Dec(RefCount);
|
||||||
|
Result := RefCount;
|
||||||
|
Raise EInOUtError.CreateFmt(SErrAlreadyLoaded,[LoadedLibrary]);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user