如何从装饰名称中取消装饰名称?

时间:2012-02-07 14:01:24

标签: c++ windows visual-studio name-mangling

At a post of Raymond Chen,他似乎能够从装饰名称中知道函数的未修饰名称。我不知道他怎么能这样做。

在这个装饰名称中,

  

?的GetName @ PushButton的@ @@ UILibrary @ UAEPB_WPAPAVStringHolder 2 @@ž

每个组件的含义是什么?

3 个答案:

答案 0 :(得分:13)

为避免猜测,仍然没有真正使用工具,UndecorateSymbolName function可能会有用。我希望这能给出一个权威的正确答案。

要手动执行此操作,this page会提供有关该方案的一些信息,these也是如此。

基本大纲为_name@scope@scope@@parameters@something@@something。我怀疑最后两个部分是堆栈大小和调用约定或类似,但文档可能有更多细节。

答案 1 :(得分:7)

名称修改与编译器有关。

在你链接的文章中,Raymond正在使用MS util(undname)来删除重整文件。

Here is a table显示常见的编译器是如何破坏的。

答案 2 :(得分:4)

Microsoft Visual Studio附带了一个undname.exe工具。

http://msdn.microsoft.com/en-us/library/ms937379.aspx

如果您在默认位置拥有MS VS,则可以使用:

  

“C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ VC \ bin \ undname.exe”?GetName @ PushButton @ UILibrary @@ UAEPB_WPAPAVStringHolder @ 2 @@ Z

     

Microsoft(R)C ++ Name Undecorator   版权所有(C)Microsoft Corporation。保留所有权利。

     

Undecoration of: - “GetName @ PushButton @ UILibrary @@ UAEPB_WPAPAVStringHolder @ 2 @@ Z”是: - “public:virtual wchar_t const * __thiscall UILibrary :: PushButton :: GetName(class UILibrary :: StringHolder * *) “