libtool: Finding the dlname
1
1 10.4 Finding the correct name to dlopen
1 =======================================
1
1 After a library has been linked with '-module', it can be dlopened.
1 Unfortunately, because of the variation in library names, your package
1 needs to determine the correct file to dlopen.
1
1 The most straightforward and flexible implementation is to determine
1 the name at runtime, by finding the installed '.la' file, and searching
1 it for the following lines:
1
1 # The name that we can dlopen.
1 dlname='DLNAME'
1
1 If DLNAME is empty, then the library cannot be dlopened. Otherwise,
1 it gives the dlname of the library. So, if the library was installed as
1 '/usr/local/lib/libhello.la', and the DLNAME was 'libhello.so.3', then
1 '/usr/local/lib/libhello.so.3' should be dlopened.
1
1 If your program uses this approach, then it should search the
1 directories listed in the 'LD_LIBRARY_PATH'(1) environment variable, as
1 well as the directory where libraries will eventually be installed.
1 Searching this variable (or equivalent) will guarantee that your program
1 can find its dlopened modules, even before installation, provided you
1 have linked them using libtool.
1
1 ---------- Footnotes ----------
1
1 (1) 'LIBPATH' on AIX, and 'SHLIB_PATH' on HP-UX.
1