I'm overriding C++ global new/delete operators on Linux project. It all works nicely in my own code, until I found out that the new/delete symbols in system libraries gets also replaced with my code! This is a very bad problem since it goes way beyond 'level of evil' I intended.
So question is how do I prevent the linker/compiler from replacing the new/delete syms from other (system) shared libraries? Or more precisely how do I control what shared libraries link syms from my library? I would want that the system libraries would still use their default new/delete implementation. Especially when the executable later loads other optional dynamic libraries with dlopen() that are not under my control.
The custom global new/delete operator implementation is build into a shared library.
I searched all over the Internet how to control the dynamic linking but didn't succeed. I first tries change the library link order on the test executable but that didn't change anything.