Let's say my software project, A, ships as a shared library (libA.so). A uses a 3rd party library, B, which it links as a shared library when I build libA.so. (Though I'm happy to use libB.a rather than libB.so if that is part of the solution.) B is used by A, but strictly speaking, the apps that link against A don't need to see any of the symbols of B, it's not part of A's public API.
OK, here's the problem: some apps link against B for their own reasons, as well as against A, and if the versions of B (the one the app uses and the one A linked against at build time) don't match, there are random crashes as the symbols clash.
How can I cause all of B's symbols to resolve against A's needs, but not export as visible symbols in libA.so? In other words, I don't want an app linking against A to ever directly resolve against B's symbols. Is that even possible?
Primarily, I need a solution on Linux, though knowing how to solve the problem on OSX and/or Windows will also be helpful down the road.
I understand how to restrict visibility of the symbols in A itself (that aren't necessary to be part of the public API of A), but how do I do this for dependent library B?