[LC++]Path of a shared library

Jack Lloyd lloyd at acm.jhu.edu
Fri Oct 22 21:51:01 UTC 2004

Actually, if your application is built with a hard-coded library path, it's
possible you won't find a library you're linked against in LD_LIBRARY_PATH or

You can try using dladdr(), but it's somewhat tricky to use. It works,
sometimes, but often the path you get back is relative instead of absolute,
lots of stupid little problems like that.


On Thu, Oct 21, 2004 at 08:08:10PM -0300, Adriano dos Santos Fernandes wrote:
> Hi All!
> In Windows is possible to discover the path of a DLL in the entry-point,
> using GetModuleFileName with the HINSTANCE of the DLL.
> I knew one way to do this in Linux. Using the LD_LIBRARY_PATH
> environment variable and looking for the filename.
> Is there a better way to do this?
> If not, the correct way to do is only look for files in LD_LIBRARY_PATH
> environment variable or have other directories to find too?
> Adriano
> _______________________________________________
> This is the Linux C++ Programming List
> : http://lists.linux.org.au/listinfo/tuxcpprogramming List

More information about the tuxCPProgramming mailing list