Linux.com

Home Linux Community Forums Programming and Development Software Development Any way to find out where a DSO was loaded from?

Any way to find out where a DSO was loaded from?

Link to this post 23 Nov 11

Is there any way for a DSO in Linux to find out where it was loaded from?
(In Windows I have the GetModuleHandle and GetModuleFilename functions to determine the full path to the library. Since I need to load other libraries from a different directory within a certain predefined hierarchy it would be convenient to have a way to get the full path to a DSO. So far I'm using an environment variable that points to the base directory.)
Thanks for any hints, Google wasn't very helpful, so far ...

Link to this post 26 Nov 11

I do not know the programming function to find the DSO location, but you can use the lsof (list open files) command to see what dependent files are being loaded by any application.

Link to this post 28 Nov 11

Thanks very much! I will look into this, didn't think of it.

Link to this post 30 Nov 11

If you can tell use what language you are programming in, then we may be able to locate the necessary programming function to obtain your required information.

Link to this post 01 Dec 11

Thanks for your answer & help!
I use plain C for this project.

Link to this post 03 Jan 12

Okay, so the basic idea is to read the information from /proc/<PID>/maps ...
Thanks for the hint with lsof.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board