Rolle
Rolle

Reputation: 2980

so files: function called from another so file than intended

Lets say my executable file, MyApp, links dynamically against an so file, boost-system.so. I compile and everything works fine for a while; my calls to boost-system funcs do what they are supposed to do.

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

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

I realize why this is not happening, but is there any way around this except renaming the namespaces in "my" boost-system to something local?

Upvotes: 4

Views: 265

Answers (1)

Răzvan Cojocaru
Răzvan Cojocaru

Reputation: 913

Use LD version scripts to hide function names that you don't want other .so files to see.

Upvotes: 1

Related Questions