I have an application which contains a statically linked library (libUtils.a
).
I turned a library which i previously had linked statically into a shared object library.
This library (SheepPopWapper.so
) also needs access to some of the functions in libUtils.a
.
When i run my application i get a runtime error:
[DynPopFactory::collectPlugins] Couldn't open so [/home/jody/progs/QHG4/dynpops/so_dir/SheepPopWrapper.so]: /home/jody/progs/QHG4/dynpops/so_dir/SheepPopWrapper.so: undefined symbol: _ZN10MessLogger17s_sCurHeaderErrorB5cxx11E
The Object MessLogger
is in libUtils.a and is visible in the application:
$ nm MainAppDyn | grep MessLogger17s
000000000026d7e0 B _ZN10MessLogger17s_sCurHeaderErrorB5cxx11E
However, if i link libUtils.a
to SheepPopWrapper.so
, everything works as expected.
But somehow it bothers me that during run time there are two copies of libUtils
. This situation also caused an actual problem because libUtils
contains an object i implemented as a singleton, and in this situation there are two singletons (one for each copy of libUtils
).
So the question is: can a shared object library access objects from a statically linked object?
And if this is the case, how can this be done?