View Compiler Mangled Names in C++

后端 未结 6 749
孤城傲影
孤城傲影 2021-01-05 02:24

How do I view the compiler-generated mangled names for overloaded functions in C++? I\'m using VC9 but answers for other compilers are welcome too.

Edit:

6条回答
  •  鱼传尺愫
    2021-01-05 03:21

    linux gnu tool chain nm command can be used to see mangled name.

    #include 
    using namespace std;
    
    int fun1(){}
    int fun1(int){}
    int main()
    {
    return 0;
    }
    
    #g++ name_decoration_2.cpp
    #nm a.out
    ...
    ...
    000000000040064e T _Z4fun1i
    0000000000400648 T _Z4fun1v
    U _ZNSt8ios_base4InitC1Ev@@GLIBCXX_3.4
    U _ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4
    

提交回复
热议问题