1 |
|
function TFBLibrary.LoadIBLibrary: boolean; |
2 |
|
|
3 |
+ |
function TryLoadLibrary(LibraryPath: AnsiString; LibNames: TStrings): TLibHandle; |
4 |
+ |
var i: integer; |
5 |
+ |
begin |
6 |
+ |
Result := NilHandle; |
7 |
+ |
for i := 0 to LibNames.Count - 1 do |
8 |
+ |
begin |
9 |
+ |
Result := LoadLibrary(LibraryPath + LibNames[i]); |
10 |
+ |
if Result <> NilHandle then |
11 |
+ |
begin |
12 |
+ |
FFBLibraryName := LibNames[i]; |
13 |
+ |
Exit; |
14 |
+ |
end; |
15 |
+ |
end; |
16 |
+ |
end; |
17 |
+ |
|
18 |
|
function FindLibrary(LibNameList: string): TLibHandle; |
19 |
|
var LibNames: TStringList; |
20 |
< |
i: integer; |
20 |
> |
FirebirdDir: Ansistring; |
21 |
|
begin |
22 |
|
Result := NilHandle; |
23 |
+ |
FirebirdDir := IncludeTrailingPathDelimiter(GetEnvironmentVariable('FIREBIRD')); |
24 |
|
LibNames := TStringList.Create; |
25 |
|
try |
26 |
|
LibNames.Delimiter := ':'; |
27 |
|
LibNames.StrictDelimiter := true; |
28 |
|
LibNames.DelimitedText := LibNameList; {Split list on semi-colon} |
29 |
< |
for i := 0 to LibNames.Count - 1 do |
29 |
> |
if FirebirdDir <> '' then |
30 |
|
begin |
31 |
< |
Result := LoadLibrary(LibNames[i]); |
32 |
< |
if Result <> NilHandle then |
33 |
< |
begin |
18 |
< |
FFBLibraryName := LibNames[i]; |
19 |
< |
Exit; |
20 |
< |
end; |
31 |
> |
Result := TryLoadLibrary(FirebirdDir,LibNames); |
32 |
> |
if Result = NilHandle then |
33 |
> |
Result := TryLoadLibrary(FirebirdDir + 'lib' + DirectorySeparator,LibNames); |
34 |
|
end; |
35 |
+ |
if Result = NilHandle then |
36 |
+ |
Result := TryLoadLibrary('',LibNames); |
37 |
|
finally |
38 |
|
LibNames.Free; |
39 |
|
end; |