Therefore files: a function called from a different file than intended

Suppose my executable MyApp is dynamically linked to such a boost-system.so file. I compile and everything works fine for a while; my calls to boost-system functions do what they should do.

After a while, I realize that I need to link another file, SomeAPI.so. However, SomeAPI.so is statically linked to boost-system.a, but an older, buggy version that has functions with exactly the same names as my boost-system (ofcourse). Now ALL calls (from both MyApp and SomeAPI) will go to the SomeAPI version, statically linked (or my boost-system version, depending on the order of links, both are harmful to me).

I would like my calls from MyApp to go to my version of boost-system and SomeAPI to use its statically related boost-system.a functions. On Windows, this is how it works.

I understand why this does not happen, but is there any way other than renaming the namespaces in "my" boost system to something local?

+4
source share
1 answer

Use LD scripts to hide the names of functions that you do not want to see in other .so files.

+1
source

Source: https://habr.com/ru/post/1499437/


All Articles