dlmopen namespaces for subplugins that look for global symbols?

GGibson

I have two+ libs that are symbol-incompatible (libA, libB) so I load them into RTLD_LOCAL namespaces. However, each one can possibly load other libs that seem to look in global namespace for the resolution of their depedencies (undefined symbols) that would be resolved by their parent (libA, or libB). Since the parent is not in global, then the sublib fails with an undefined symbol. If I load libA in global, then the sublib works but I can't load libB due to conflicts with libA. dlmopen into a specific namespace does not seem to impose namespace restrictions on sublibs.

Is there some way to specify that all sublibraries of libA should load into libA's namespace if asking for global?

My only solution is to completely load and unload the libraries (and performing any initialization) every time I need to switch libraries.

Employed Russian

Is there some way to specify that all sublibraries of libA should load into libA's namespace if asking for global?

No such mechanism exists in GLIBC.

You didn't specify your target, but given that dlmopen is a GLIBC extension, I am assuming you are asking about a Linux / GLIBC solution.

Having two incompatible / conflicting libraries in the same process is just asking for trouble. You should get your dependencies to agree on either Python 3.7 or Python 3.9, or use multiple processes -- that's the only way you'll arrive at a sane execution environment.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324294637&siteId=291194637