This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is it possible to link solib privately?


Hi.

My problem is as follows.

Say, I have 2 libs: foo (libfoo.so) and bar (libbar.so).
foo uses the API of bar, and is therefore linked with -lbar.
There is also an app that uses the API of both foo and
bar, and is therefore linked with -lfoo -lbar.

Now lets assume that bar is coded in some poor way and
its API depends on a global state a lot. When the app
uses it, it works fine. When foo uses it, it works fine as well.
But when they use it together (even without threads, sequentially),
its global state gets corrupted and the API stops working.

My question is: is it possible to link bar to foo somehow
privately, so that it uses the private data sections, independent
of those used when the app calls the bar API directly?
I know how to do that if libbar is a static lib, but it is not static,
and also it would be nice to have the code sections still shared.

Is there some magic linker flag to achieve what I want?
Or any other work-arounds I can consider?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]