On 15 Aug 2012, at 12:43, Graeme Geldenhuys wrote:

> This issue has come up before in a fcl-db discussion regarding the
> Firebird Database, where the libfbclient.so was missing from many
> Linux distros (eg: Ubuntu 10.04), but a libfbclient.so.2.0 was
> available instead. FCL-DB only checks for the unversioned shared
> libraries, thus your application will probably not run out of the box.
> 
> In both these cases, I manually created unversioned symlinks to those
> libraries, and that got my applications working again. This is not
> ideal, but I don't know how else to handle this.

The official way to get the unversioned symbolic links is to install the -dev 
or -devel package for that library. Of course, you're not supposed to require 
end-users to do that.

> Does any body know what is the "most correct" way of handling this?

Determine which major version of the library you require (e.g. 1.x, or 2.x, or 
even something like 5.1.x if the library in question only supports API 
compatibility across minor releases), and explicitly load that one. That is 
also how it works when linking against a library at compile time: the 
unversioned name is simply a symbolic link to a versioned file name, and it's 
that versioned file name that the linker will hardcode in your application. The 
reasoning is that your application was written and tested against that version 
of the library, so letting it use arbitrary other versions is not a good idea.

If you can work with multiple major versions, you can try to dynamically load 
them all until you have found one that exists. At least most (if not all) FCL 
units that dynamically load libraries have a function that you can call to 
explicitly specify the name of the dynamic library to use. Since the units 
themselves have presumably been written to work with certain versions of those 
libraries, it would however probably be best if that code were directly added 
to those units (and to remove any *default* dynamic loading of unversioned file 
names, since such libraries usually only exist on a developer's machine -- 
except maybe on non-Unix platforms).


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to