Why does typeid::name return a random name instead of the exported name?

90 Views Asked by At

I'm trying to get the name of a function. Let's imagine our function is the following:

extern DLLEXPORT void __attribute__((optimize("O0"))) my_amazing_function(double arg) { ... }

Instead of getting the expected _Z19my_amazing_functiond, I get something like FvdE.

Why does this happen?

here is my magic code:

typeid(&my_amazing_function).name()
1

There are 1 best solutions below

2
apple apple On

typeid returns typeinfo for the type, which is void(double) in this case, and has nothing to do with function name (mangled or not).