I have an executable with four shared libraries and the dependency tree look like this: Executable app does a dlopen of foo.so
and bar.so
. foo.so
in turn links to fooHelper.so
and bar.so
links to barHelper.so
.
Now, the issue is that fooHelper.so
and barHelper.so
have some of the same symbols. For instance, let us say we have a func
with different implementations in fooHelper.so
and barHelper.so
. Is there a way to force foo.so
to use fooHelper.so
's implementation and bar.so
to use barHelper.so
's? What happens at present is that depending on the order of linking of the helpers, only one of the implementations of func
is used by both foo.so
and bar.so
. This is because of the default Unix linkage model, if the definition of a symbol is already loaded, then any other definitions from shared libraries loaded subsequently are just discarded. Basically, func
will be picked up from the helper library linked first. I need a way to explicitly specify the appropriate mapping without changing the source code of the shared libraries.
I'm working on Linux with g++ 4.4.