I need to write a plugin for an application that statically includes a certain C++ library that doesn't use namespaces.
Unfortunately my plugin needs to link against a customized version of the same library.
Ideally I would like to recompile it so that its symbols don't clash with those found in the application.
One way to do that, without having to edit hundreds of files and without losing the ability to apply new updates from upstream, would be to add a namespace prefix to the library at compile time.
Apparently though there's no g++
option to do that. Alternatively is there any way to programmatically alter symbols in an already compiled .so
file?
altering the compilation using preprocessor directives as suggested in another question ( Renaming symbols at compile time without changing the code in a cross platform way ) wouldn't be practical because the amount of symbols is huge
trying to get namespaces approved upstream as a patch is the best long term solution, but this would likely take a while and I need a temporary solution in the meanwhile
EDIT: to clarify, the problem is not at the library-plugin boundary, that's the "easy" part; the problem is that I've got this huge library and I'd like to find a way to recompile it as if it all belonged to a certain namespace without having to change the source code.