On Friday 22 February 2013, David Faure wrote: > On Thursday 21 February 2013 19:20:56 Alexander Neundorf wrote: ... > > Is there a way to find out where a library itself is located ? > > Not that I know.
Found something :-) Under Windows it's GetModuleHandleEx(), with glibc dladdr() (see attached example) works. The man page says it's not portable, but at least there are also man pages for dladdr() for FreeBSD, OSX and SunOS. IMO this should be good enough. This is how it is done for cmake's Config.cmake files: if a path is not in the same prefix as the Config.cmake file, the full absolute path is configured into the Config.cmake file. If the other path (e.g. to libexec) is in the same prefix, the relative path is configured into the Config.cmake file. We could do the same with libraries. If LIBEXEC_INSTALL_DIR is in the same prefix as LIB_INSTALL_DIR (it usually is), we configure the relative path into the library. If it is somewhere else, (or if LIB_INSTALL_DIR is /lib[64] or /usr/lib[64]), we can configure the full path to the other directory into the library. At runtime we then check whether we have a relative or absolute path to the directory in question, and if it is relative, we find ourselves and append the relative path to our location. Then we should have it. Alex
dladdr.tar.gz
Description: application/compressed-tar
_______________________________________________ Kde-frameworks-devel mailing list Kde-frameworks-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-frameworks-devel