Say I have a library libfoo.so.1
, which depends (according to ldd
) on libbar.so.1
. However, libbar.so.1
is not available at the moment. My app needs to call a function in libfoo.so.1
which doesn't require libbar.so.1
at all.
Is there a way to load libfoo.so.1
, resolve the function symbol and then call it without having libbar.so.1
to satisfy the dependency? It's a case of "I know what I'm doing, just let me do it already". I tried the RTLD_LAZY flag, but it still tries to load the libbar.so.1
library before not loading the symbols.
EDIT
Here's the exact situation.
We have 3 players:
libbar.so.1
, a shared library located in a path not inLD_LIBRARY_PATH
orldconfig
, and whose dependencies are all resolvedlibfoo.so.1
, a shared library located in a different directory thanlibbar
, but which depends onlibbar
. At runtime,libfoo
will know where to locatelibbar
.App
, a binary application which needs to loadlibfoo
at some point during runtime.
App
doesn't know where to find libbar
, but knows that libfoo
knows. What I'm trying to accomplish is having an init function in libfoo
which would simply change App
's current working directory to where libbar
is located to finally resolve all the dependencies and make everyone happy.
libfoo
will eventually need to call stuff in libbar
, just not in this init function. I don't think creating a stub would work since the symbols would eventually need to resolve to the real functions.