1 |
procedure TFBClientAPI.LoadIBLibrary; |
2 |
|
3 |
function FindLibrary(LibNameList: string): TLibHandle; |
4 |
var LibNames: TStringList; |
5 |
i: integer; |
6 |
begin |
7 |
Result := NilHandle; |
8 |
LibNames := TStringList.Create; |
9 |
try |
10 |
LibNames.Delimiter := ':'; |
11 |
LibNames.StrictDelimiter := true; |
12 |
LibNames.DelimitedText := LibNameList; {Split list on semi-colon} |
13 |
for i := 0 to LibNames.Count - 1 do |
14 |
begin |
15 |
Result := LoadLibrary(LibNames[i]); |
16 |
if Result <> NilHandle then |
17 |
begin |
18 |
FFBLibraryName := LibNames[i]; |
19 |
Exit; |
20 |
end; |
21 |
end; |
22 |
finally |
23 |
LibNames.Free; |
24 |
end; |
25 |
end; |
26 |
|
27 |
var LibName: string; |
28 |
begin |
29 |
if IBLibrary <> NilHandle then Exit; |
30 |
|
31 |
LibName := GetOverrideLibName; |
32 |
if LibName = '' then |
33 |
LibName := GetFirebirdLibList; |
34 |
IBLibrary := FindLibrary(LibName); |
35 |
{$IFDEF DARWIN} |
36 |
if IBLibrary = NilHandle then |
37 |
begin |
38 |
{See http://paulbeachsblog.blogspot.co.uk/2008/03/where-is-libfbclientdylib-on-macosx.html |
39 |
Try loading direct from Firebird Framework} |
40 |
|
41 |
LibName := '/Library/Frameworks/Firebird.framework/Firebird'; |
42 |
IBLibrary := LoadLibrary(LibName); |
43 |
if IBLibrary = NilHandle then |
44 |
begin |
45 |
LibName := '/Library/Frameworks/Firebird.framework/Libraries/libfbclient.dylib'; |
46 |
IBLibrary := LoadLibrary(LibName); |
47 |
end; |
48 |
if IBLibrary <> NilHandle then |
49 |
FFBLibraryName := ExtractFileName(LibName); |
50 |
end; |
51 |
{$ENDIF} |
52 |
FOwnsIBLibrary := IBLibrary <> NilHandle; |
53 |
end; |
54 |
|
55 |
|
56 |
|
57 |
|