GCC Name Mangling
I recently had an interesting bit of code to work with - functions were aliased to a mangled function name. I had changed some code, and now the project refused to compile, saying that the name could not be found. I wondered how to solve this chicken and egg problem: the mangled name is output by the compiler, but it won't compile when there are errors.
Turns out you can do it manually!
1234567891011 |
#define MYFOOBARALIAS __attribute__ ((weak, alias ("_ZN3Foo3barEv")))
void Foo::bar() {
...
}
|
Ches Koblents
January 15, 2015