Re: Shared Library Options (243 Views)
Reply
Occasional Visitor
Vladstone
Posts: 1
Registered: ‎08-16-2011
Message 1 of 2 (247 Views)

Shared Library Options

Is there anyway to set up a c++ application that searches for a function in shared libraries as follows:

 

1) Look in the shared library in the current directory

2) If not found in the current directory's shared library look for a shared library of the same name on the search path and try to find the function there.

 

Thanks,

Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 2 of 2 (243 Views)

Re: Shared Library Options

Are you talking about searching at link time, load time or at runtime?

The first can be done with -L path options.

The second with LD_LIBRARY_PATH and -Wl,+b paths

The third with dlopen and dlsym.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.