@@ -1771,9 +1771,9 @@ function TConnectionParameters.DefaultLibrary: String;
17711771 ngMSSQL: Result := ' MSOLEDBSQL' ; // Prefer MSOLEDBSQL provider on newer systems
17721772 ngInterbase: begin
17731773 if IsInterbase then
1774- Result := IfThen(GetExecutableBits=64 , ' ibclient64.' , ' gds32.' ) + GetDynLibExtension
1774+ Result := IfThen(GetExecutableBits=64 , ' ibclient64.' , ' gds32.' ) + SharedSuffix
17751775 else if IsFirebird then
1776- Result := ' fbclient.' + GetDynLibExtension ;
1776+ Result := ' fbclient.' + SharedSuffix ;
17771777 end
17781778 end ;
17791779end ;
@@ -1858,12 +1858,11 @@ function TConnectionParameters.GetLibraries: TStringList;
18581858var
18591859 rx: TRegExpr;
18601860 FoundLibs: TStringList;
1861- { $IfDef WINDOWS}
1861+ { $If defined( WINDOWS) OR defined(DARWIN) }
18621862 DllPath, DllFile: String;
18631863 Dlls { , Providers} : TStringList;
18641864 { Provider: String;}
1865- { $EndIf}
1866- { $IfDef LINUX}
1865+ { $ElseIf defined(LINUX)}
18671866 LibMapOutput, LibMap: String;
18681867 LibMapLines: TStringList;
18691868 { $EndIf}
@@ -1878,36 +1877,36 @@ function TConnectionParameters.GetLibraries: TStringList;
18781877 rx.ModifierI := True;
18791878 case NetTypeGroup of
18801879 ngMySQL:
1881- { $If defined( LINUX) }
1880+ { $IfDef LINUX}
18821881 // libmariadb.so.0 (libc,...) => /lib/x86_64-linux-gnu/libmariadb.so
18831882 rx.Expression := ' ^\s*lib(mysqlclient|mariadb|perconaserverclient)\.[^=]+=>\s*(\S+)$' ;
1884- { $ElseIf defined(WINDOWS) }
1885- rx.Expression := ' ^lib(mysql|mariadb).*\.' + GetDynLibExtension ;
1883+ { $Else }
1884+ rx.Expression := ' ^lib(mysql|mariadb).*\.' + SharedSuffix ;
18861885 { $EndIf}
18871886 ngMSSQL: // Allow unsupported ADODB providers per registry hack
18881887 rx.Expression := IfThen(AppSettings.ReadBool(asAllProviders), ' ^' , ' ^(MSOLEDBSQL|SQLOLEDB)' );
18891888 ngPgSQL:
1890- { $If defined( LINUX) }
1889+ { $IfDef LINUX}
18911890 rx.Expression := ' ^\s*(libpq)[^=]+=>\s*(\S+)$' ;
1892- { $ElseIf defined(WINDOWS) }
1893- rx.Expression := ' ^libpq.*\.' + GetDynLibExtension ;
1891+ { $Else }
1892+ rx.Expression := ' ^libpq.*\.' + SharedSuffix ;
18941893 { $EndIf}
18951894 ngSQLite: begin
1896- { $If defined( LINUX) }
1895+ { $IfDef LINUX}
18971896 rx.Expression := ' ^\s*(libsqlite3)[^=]+=>\s*(\S+)$' ;
1898- { $ElseIf defined(WINDOWS) }
1897+ { $Else }
18991898 if NetType = ntSQLite then
1900- rx.Expression := ' ^sqlite.*\.' + GetDynLibExtension
1899+ rx.Expression := ' ^sqlite.*\.' + SharedSuffix
19011900 else
1902- rx.Expression := ' ^sqlite3mc.*\.' + GetDynLibExtension ;
1901+ rx.Expression := ' ^sqlite3mc.*\.' + SharedSuffix ;
19031902 { $EndIf}
19041903 end ;
19051904 ngInterbase:
1906- rx.Expression := ' ^(gds32|ibclient|fbclient).*\.' + GetDynLibExtension ;
1905+ rx.Expression := ' ^(gds32|ibclient|fbclient).*\.' + SharedSuffix ;
19071906 end ;
19081907 case NetTypeGroup of
19091908 ngMySQL, ngPgSQL, ngSQLite, ngInterbase: begin
1910- { $If defined( LINUX) }
1909+ { $IfDEF LINUX}
19111910 // See https://serverfault.com/a/513938
19121911 Process.RunCommandInDir(' ' , ' /sbin/ldconfig' , [' -p' ], LibMapOutput);
19131912 LibMapLines := Explode(sLineBreak, LibMapOutput);
@@ -1916,8 +1915,8 @@ function TConnectionParameters.GetLibraries: TStringList;
19161915 FoundLibs.Add(rx.Match[2 ]);
19171916 end ;
19181917 end ;
1919- { $ElseIf defined(WINDOWS) }
1920- Dlls := FindAllFiles(ExtractFilePath(ParamStr(0 )), ' *.' + GetDynLibExtension , False);
1918+ { $Else }
1919+ Dlls := FindAllFiles(ExtractFilePath(ParamStr(0 )), ' *.' + SharedSuffix , False);
19211920 for DllPath in Dlls do begin
19221921 DllFile := ExtractFileName(DllPath);
19231922 if rx.Exec(DllFile) then begin
@@ -2283,11 +2282,11 @@ procedure TMySQLConnection.SetLockedByThread(Value: TThread);
22832282 if Value <> nil then begin
22842283 // We're running in a thread already. Ensure that Log() is able to detect that.
22852284 FLockedByThread := Value ;
2286- Log(lcDebug, ' mysql_thread_init, thread id #' +IntToStr(Value .ThreadID));
2285+ Log(lcDebug, ' mysql_thread_init, thread id #' +IntToStr(Integer( Value .ThreadID) ));
22872286 FLib.mysql_thread_init;
22882287 end else begin
22892288 FLib.mysql_thread_end;
2290- Log(lcDebug, ' mysql_thread_end, thread id #' +IntToStr(FLockedByThread.ThreadID));
2289+ Log(lcDebug, ' mysql_thread_end, thread id #' +IntToStr(Integer( FLockedByThread.ThreadID) ));
22912290 FLockedByThread := Value ;
22922291 end ;
22932292 end ;
@@ -3311,7 +3310,7 @@ procedure TMySQLConnection.DoBeforeConnect;
33113310 LibraryPath: String;
33123311begin
33133312 // Init libmysql before actually connecting.
3314- LibraryPath := Parameters.LibraryOrProvider;
3313+ LibraryPath := { $IFNDEF LINUX } ExtractFilePath(ParamStr( 0 )) + { $ENDIF } Parameters.LibraryOrProvider;
33153314 Log(lcDebug, f_(' Loading library file %s ...' , [LibraryPath]));
33163315 // Throws EDbError on any failure:
33173316 FLib := TMySQLLib.Create(LibraryPath, Parameters.DefaultLibrary);
@@ -3326,7 +3325,7 @@ procedure TPgConnection.DoBeforeConnect;
33263325 msg: String;
33273326begin
33283327 // Init lib before actually connecting.
3329- LibraryPath := Parameters.LibraryOrProvider;
3328+ LibraryPath := { $IFNDEF LINUX } ExtractFilePath(ParamStr( 0 )) + { $ENDIF } Parameters.LibraryOrProvider;
33303329 Log(lcDebug, f_(' Loading library file %s ...' , [LibraryPath]));
33313330 try
33323331 FLib := TPostgreSQLLib.Create(LibraryPath, Parameters.DefaultLibrary);
@@ -3357,7 +3356,7 @@ procedure TSQLiteConnection.DoBeforeConnect;
33573356 LibraryPath: String;
33583357begin
33593358 // Init lib before actually connecting.
3360- LibraryPath := Parameters.LibraryOrProvider;
3359+ LibraryPath := { $IFNDEF LINUX } ExtractFilePath(ParamStr( 0 )) + { $ENDIF } Parameters.LibraryOrProvider;
33613360 Log(lcDebug, f_(' Loading library file %s ...' , [LibraryPath]));
33623361 // Throws EDbError on any failure:
33633362 if Parameters.NetType = ntSQLite then
0 commit comments