On Fri, 27 Nov 2009, Graeme Geldenhuys wrote:
OK, below is one example of a patch, but there are alternative methods too, hence I am first posting here in the mailing list before I officially put something in Mantis. In the example below (which does work) I simply test for the newest major version first, then un-versioned, then backward compatibility library. ---------------------------------------- diff --git a/packages/ibase/src/ibase60.inc b/packages/ibase/src/ibase60.inc index 5bc668d..54e2ab3 100644 --- a/packages/ibase/src/ibase60.inc +++ b/packages/ibase/src/ibase60.inc @@ -2647,8 +2647,9 @@ begin end else begin - If (TryInitialiseIBase60(fbclib)=0) and - (TryInitialiseIBase60(gdslib)=0) then + If (TryInitialiseIBase60(fbclib+'.2')=0) and // major versioned + (TryInitialiseIBase60(fbclib)=0) and // un-versioned + (TryInitialiseIBase60(gdslib)=0) then // backward compatibility Raise EInOutError.CreateFmt(SErrDefaultsFailed,[gdslib,fbclib]); end; Result := RefCount; ---------------------------------------- What I don't like about the patch above, is the 'and' statement. Wouldn't it be better (optimised) to do the following: if not v2 found then // libfbclient.so.2 if not unversioned found then // libfbclient.so if not gds found then // libgds.so raise Exception.Create(...) That way it will stop at the first if that found a valid library. Yet another alternative to the above if statement, is to test for the unversioned library first - this should make Joost happy & non-Ubuntu installs. That way DB developers could simply adjust the unversioned library symlink (libfbclient.so) and FPC would automatically load the developers desired version of the library. I think this is the best option so far. eg: if not unversioned found then // libfbclient.so if not v2 found then // libfbclient.so.2 if not gds found then // libgds.so raise Exception.Create(...) Your thoughts?
I'd use an array of library names and a for loop. It is easier to extend. You can add fbclient.1 and
fbclient.3 to the array. Michael. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel