Can I ungarble GCC RTTI names?

Using gcc, when I query the type of an object / variable using typeid, I get a different result from the type_info :: name method from what I expect to get on Windows. I searched Google a bit and found out that RTTI names are implementation specific.

The problem is that I want to get the type name that will be returned in Windows. Is there an easy way to do this?

+6
c ++ rtti g ++ name-mangling
source share
3 answers

If this is what you are asking for, there is no compiler to do gcc like msvc regarding the name returned by type_info::name() .

However, in your code you can rely on the special gcc __cxa_demangle function.

Actually there is an answer to SO that concerns your problem .

Link: libstdc ++ manual, chapter 40. Demangling .

+7
source share

C ++ function names really include all the information such as the return and argument, as well as the name of the class and method. When compiled, they are "crippled" in a standard form (standard for each compiler), which can act as an assembler symbol and includes all type information.

You need to run a function or program to undo this manipulation called a demanger.

try to run

 c++filt myoutput.txt 

output function. This again displays the real character name in a human-readable form.

+1
source share

Based on this other question, is there an online demanger for C ++? I wrote an online tool for this: c ++ filtjs

0
source share

All Articles