mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 00:39:34 +02:00
* Changed library names to include version number, make uniform dynamic loader interface
git-svn-id: trunk@22162 -
This commit is contained in:
parent
396a9cafa8
commit
6926b50f2c
@ -19,9 +19,21 @@ uses Dynlibs,ctypes;
|
||||
{$IFDEF Unix}
|
||||
{$DEFINE extdecl:=cdecl}
|
||||
const
|
||||
gdslib = 'libgds.'+sharedsuffix;
|
||||
fbclib = 'libfbclient.'+sharedsuffix;
|
||||
fbembedlib = 'libfbembed.'+sharedsuffix;
|
||||
gdslib = 'libgds.'+sharedsuffix; // Needs completion ?
|
||||
libfc = 'libfbclient.'+sharedsuffix;
|
||||
libem = 'libfbembed.'+sharedsuffix;
|
||||
v2 = {$ifndef darwin}'.2'{$endif};
|
||||
v21 = {$ifndef darwin}'.2.1'{$endif};
|
||||
v25 = {$ifndef darwin}'.2.5'{$endif};
|
||||
fbclib2 = libfc+v2;
|
||||
fbembedlib2 = libem+v2;
|
||||
fbclib21 = libfc+v21;
|
||||
fbembedlib21 = libem+v21;
|
||||
fbclib25 = libfc+v25;
|
||||
fbembedlib25 = libem+v25;
|
||||
// Set default here
|
||||
fbclib = fbclib25;
|
||||
fbembedlib = fbembedlib25;
|
||||
{$ENDIF}
|
||||
{$IFDEF Windows}
|
||||
{$DEFINE extdecl:=stdcall}
|
||||
@ -2655,15 +2667,19 @@ function InitialiseIBase60 : integer;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
If UseEmbeddedFirebird then
|
||||
if (RefCount<>0) then
|
||||
// pretend to load whatever is already loaded, so we do not get a library name conflict.
|
||||
Inc(RefCount)
|
||||
else If UseEmbeddedFirebird then
|
||||
begin
|
||||
If (TryInitialiseIBase60(fbembedlib)=0) then
|
||||
If (TryInitialiseIBase60(fbembedlib)=0) and (TryInitialiseIBase60(libem)=0) then
|
||||
Raise EInOutError.CreateFmt(SErrEmbeddedFailed,[fbembedlib]);
|
||||
end
|
||||
else
|
||||
begin
|
||||
If (TryInitialiseIBase60(fbclib)=0) and
|
||||
(TryInitialiseIBase60(gdslib)=0) and
|
||||
(TryInitialiseIBase60(libfc)=0) and
|
||||
(TryInitialiseIBase60(fbembedlib)=0) then
|
||||
Raise EInOutError.CreateFmt(SErrDefaultsFailed,[fbclib,gdslib,fbembedlib]);
|
||||
end;
|
||||
|
@ -1596,7 +1596,8 @@ uses
|
||||
{$endif}
|
||||
|
||||
{$IFDEF LinkDynamically}
|
||||
Function InitialiseMysql(Const LibraryName : String; argc:cint = -1; argv:PPchar = nil; groups:PPchar = nil) : Integer;
|
||||
Function InitialiseMysql(Const LibraryName : String) : Integer;
|
||||
Function InitialiseMysql(Const LibraryName : String; argc: cint; argv:PPchar = Nil; groups:PPchar = nil) : Integer;
|
||||
Function InitialiseMysql(argc:cint = -1; argv:PPchar = nil; groups:PPchar = nil) : Integer;
|
||||
Procedure ReleaseMysql;
|
||||
|
||||
@ -1745,12 +1746,22 @@ Function InitialiseMysql(argc: cint; argv: PPchar; groups: PPchar) : Integer;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
If (TryInitialiseMysql(mysqlvlib,argc,argv,groups) = 0) and
|
||||
(TryInitialiseMysql(mysqllib,argc,argv,groups) = 0) then
|
||||
if (RefCount<>0) then
|
||||
// pretend to load whatever is already loaded, so we do not get a library name conflict.
|
||||
Inc(RefCount)
|
||||
else
|
||||
If (TryInitialiseMysql(mysqllib,argc,argv,groups)=0)
|
||||
and (TryInitialiseMysql(mysqlvlib,argc,argv,groups)=0) then
|
||||
Raise EInOutError.CreateFmt(SErrDefaultsFailed,[mysqlvlib,mysqllib]);
|
||||
Result := RefCount;
|
||||
end;
|
||||
|
||||
Function InitialiseMysql(Const LibraryName: String) : Integer;
|
||||
|
||||
begin
|
||||
Result:=InitialiseMySQL(LibraryName,-1,Nil,Nil);
|
||||
end;
|
||||
|
||||
Function InitialiseMysql(Const LibraryName: String; argc: cint; argv: PPchar; groups:PPchar) : Integer;
|
||||
|
||||
begin
|
||||
|
@ -16,11 +16,18 @@ uses
|
||||
|
||||
{$IFDEF Unix}
|
||||
const
|
||||
pqlib = 'libpq.'+sharedsuffix;
|
||||
{$ifdef darwin}
|
||||
pqlib = 'libpq.'+sharedsuffix; // No version number.
|
||||
{$else}
|
||||
pqlib5 = 'libpq.'+sharedsuffix+'.5'; // 8.2 and higher
|
||||
pqlib4 = 'libpq.'+sharedsuffix+'.4'; // 8.0, 8.1
|
||||
pqlib3 = 'libpq.'+sharedsuffix+'.3'; // 7.3, 7.4
|
||||
pqlib = pqlib5;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
{$IFDEF Win32}
|
||||
const
|
||||
pqlib = 'libpq.dll';
|
||||
pqlib = 'libpq.dll'; // Not sure if it has a version number ?
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
@ -210,7 +217,8 @@ var
|
||||
{ Get encoding id from environment variable PGCLIENTENCODING }
|
||||
PQenv2encoding: function :longint;cdecl;
|
||||
|
||||
Procedure InitialisePostgres3(libpath:string=pqlib);
|
||||
Function InitialisePostgres3(Const libpath : shortstring) : integer;
|
||||
Procedure InitialisePostgres3;
|
||||
Procedure ReleasePostgres3;
|
||||
|
||||
function PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME : pchar) : ppgconn;
|
||||
@ -227,10 +235,22 @@ var
|
||||
RefCount : integer;
|
||||
LoadedLibrary : String;
|
||||
|
||||
Procedure InitialisePostgres3(libpath:string=pqlib);
|
||||
procedure InitialisePostgres3;
|
||||
|
||||
begin
|
||||
if (RefCount<>0) then
|
||||
// pretend to load whatever is already loaded, so we do not get a library name conflict.
|
||||
inc(Refcount)
|
||||
else
|
||||
InitialisePostgres3(pqlib)
|
||||
end;
|
||||
|
||||
|
||||
function InitialisePostgres3(Const libpath : shortstring) : Integer;
|
||||
|
||||
begin
|
||||
inc(RefCount);
|
||||
Result:=Refcount;
|
||||
if RefCount = 1 then
|
||||
begin
|
||||
Postgres3LibraryHandle := loadlibrary(libpath);
|
||||
@ -344,7 +364,7 @@ begin
|
||||
pointer(PQmblen) := GetProcedureAddress(Postgres3LibraryHandle,'PQmblen');
|
||||
pointer(PQenv2encoding) := GetProcedureAddress(Postgres3LibraryHandle,'PQenv2encoding');
|
||||
|
||||
InitialiseDllist;
|
||||
InitialiseDllist(libpath);
|
||||
end
|
||||
else
|
||||
if (libpath<>pqlib) and (LoadedLibrary<>libpath) then
|
||||
|
Loading…
Reference in New Issue
Block a user