简体   繁体   English

MSVC功能分解

[英]MSVC function demangling

I have next functions: 我有下一个功能:

namespace TEST {
    class TEST {
        int a;
        int b;
    };
}

namespace UNION_TEST {
    union UNION_TEST {
        int a;
        int b;
    };
}

union UNION_TEST_NEW {
    int a;
    int b;
};

namespace NAMESPACE_1 {
    namespace NAMESPACE_2 {
        union UNION_NAMESPACE_2 {
            int a, b;
        };
    }
}


void f1(UNION_TEST::UNION_TEST t, UNION_TEST::UNION_TEST t1) {
    return;
}

void f2(UNION_TEST::UNION_TEST t, TEST::TEST c, UNION_TEST::UNION_TEST t1) {
    return;
}

void f3(UNION_TEST_NEW u) {
    return;
}

void f4(NAMESPACE_1::NAMESPACE_2::UNION_NAMESPACE_2 u, TEST::TEST c, UNION_TEST::UNION_TEST t1) {
    return;
}

And correspond mangled symbols are: 对应的错误符号为:

0x000034e0  2  .text  ?f1@@YAXTUNION_TEST@1@0@Z
0x00003500  2  .text  ?f2@@YAXTUNION_TEST@1@VTEST@2@0@Z
0x00003520  2  .text  ?f3@@YAXTUNION_TEST_NEW@@@Z
0x00003530  2  .text  ?f4@@YAXTUNION_NAMESPACE_2@NAMESPACE_2@NAMESPACE_1@@VTEST@4@TUNION_TEST@5@@Z

Accroding to this http://www.agner.org/optimize/calling_conventions.pdf (page 27) we have that union X -> TX@@, so why for the function f1, f2 there is no @@ at the end and how than distiguish when union with namespace is end and start next argument? 对此http://www.agner.org/optimize/calling_conventions.pdf (第27页)感到满意,我们拥有并集X-> TX @@,所以为什么函数f1,f2在末尾没有@@,与命名空间的联合结束并开始下一个参数时,如何区分呢?

Thank U for attention and help. 感谢您的关注和帮助。

As you observed, the claim that a union name X is transformed to TX@@ is not a correct description of the name mangling used by your MSVC version. 如您所见,将联合名X转换为TX@@说法不是对MSVC版本使用的名称改写的正确描述。 Note that "agner.org" is not associated with Microsoft, and doesn't provide official documentation. 请注意,“ agner.org”与Microsoft无关,并且不提供官方文档。

As for your question how the different parts of a mangled name are separated, it appears that a single @ is sufficient. 关于您的问题,如何将名称的不同部分分隔开,看来一个@就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM