Hey guys, I need to make a list of some functions that are listed in the linker output. The syntax i get is as follows:
int foo(int num,double dnum,开发者_JAVA技巧 Temp & temp) (in namespace "funcsns")
Turns into:
.text._ZN7funcsns3fooEidRNS_4TempE
(You might know it from the "undefined symbol" and some other linking errors that print functions names)
Now, i can write a script that somehow turns it into something readable but i wonder if there is a smart way of doing it.
Please share your ideas! thanks.On a system using the GNU toolchain, the c++filt program does exactly what you're looking for. It's part of the "binutils" package. Dunno about other systems.
The ".text." isn't part of the mangled name. Running c++filt _ZN7funcsns3fooEidRNS_4TempE yields funcsns::foo(int, double, funcsns::Temp&).
This is called decoration or name mangling. Here is some information on how it works for various compilers
http://www.kegel.com/mangle.html
As indicated by other, c++filt is the way to go for the GNU toolchain.
This can also be done programmaticaly (even from a C program) : see abi::__cxa_demangle (which is actually what c++filt does).
The undname utility provided with visual studio (At least VC2005 that I'm currently using) does the same as c++filt for microsoft visual c++
加载中,请稍侯......
精彩评论