C++函数调用汇编模块
我想在汇编中编写一个自定义模块并让我的 C++ 函数调用它。我不想从头开始,而是用 C 编写“草稿”,并让编译器生成蓝图汇编源,即由 /FA 编译器选项生成的列表文件。
但是,我发现生成的所有过程名称都已经是修饰形式了。此外,MASM还将再次进行自己的名称装饰。因此,如果我在不首先手动取消修饰编译器生成的过程名称的情况下组装我的版本,我会收到链接器错误,因为函数名称不匹配。
是否可以防止这种类型的重复名称装饰?
I want to write a customized module in assembly and have my C++ functions invoke it. Instead of starting from scratch I would like to write the "draft" in C and let the compiler generates a blue print assembly source i.e.the listing file generated by the /FA compiler option.
However, I found that all the procedure names generated are already in decorated form. Furthermore, the MASM will carry out its own name decoration again. So if I assemble my version without undecorating the compiler generated procedure name manually first I would get a linker error since the function names would not be matching.
Is possible to prevent this type of duplicated name decoration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
声明函数
extern "C"
应该会导致生成的汇编程序显示您应在汇编程序中使用的名称。只是不要忘记在标头中将其设为extern "C"
,以便稍后将其声明为 C++。Declaring the function
extern "C"
should result in the generated assembler showing the name you should use in assembler. Just don't forget to make itextern "C"
in the header which declares it to C++ later.您可以将函数声明为
extern "C"
。这样,它最多会在名称前加一个下划线:将成为
You can declare your function as
extern "C"
. That way, it will at most get an underscore before the name:Will become