[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [LC++]Path of a shared library



I'll try to use dladdr.

Thank you.


Adriano

Jack Lloyd wrote:
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
/etc/ld.so.conf.

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.

-Jack

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