MASM x86快速调用函数声明...如何? [英] MASM x86 fastcall function declaration... how?

查看:150
本文介绍了MASM x86快速调用函数声明...如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图使VisualStudio 2010 C程序调用快速调用约定汇编例程.

I'm trying to make a VisualStudio 2010 C program call a fastcall convention assembly routine.

这是C代码中的声明:

extern boolean _fastcall InNonSuspendableCriticalRegion(DWORD);

这是汇编代码中的声明:

This is the declaration in the assembly code:

      public @InNonSuspendableCriticalRegion@4

  @InNonSuspendableCriticalRegion@4 proc near ; fastcall
         <code>
  @InNonSuspendableCriticalRegion@4 endp

我收到以下链接器错误:

I get the following linker error:

   Assembling: C:\DMS\Domains\PARLANSE\Tools\RunTimeSystem\Source\PARLANSE0.asm
   1>RuntimeSupport.obj : error LNK2001: unresolved external symbol @InNonSuspendableCriticalRegion@4

我确定自己在做一些愚蠢的错误,但是我看不到.

I'm sure I'm doing something silly wrong, but I can't see it.

由于非常模糊,因此很难找到MS文档.我记得在过去的迷雾中,汇编器也进行了一些名称修饰,所以我不确定 如果我提供的名字被弄乱了.

The MS documentation is pretty hard to figure out since it is so vague. I recall in the mists of the past that the assembler does some name mangling, too, so I'm not sure how the names I'm providing are getting mangled, if they are.

这是关于如何操作的最明确的参考做到这一点,我想我正在完全遵循它;它说,

This is the most explicit reference on how do it, and I think I'm following it exactly; it says,

13. FASTCALL Caller and Callee Summary

The following sample illustrates the code generated in the calling function and in the called function to support __fastcall, the fastcall calling convention:

   int __fastcall FastFunc( int a, int b );

      calling function    called function
      -------------------------------------------
      mov edx, b          @FastFunc@8 PROC NEAR
      mov ecx, a                       .
      call @FastFunc@8                 .
       .                               .
       .                              RET 8
       .                  @FastFunc@8 ENDP

有任何线索吗?

谢谢...

推荐答案

尝试在两个目标文件上运行dumpbin以转储符号表.该名称应同时显示所发出的函数名称和引用函数的名称.通常,这对于诊断这类问题很有帮助.

Try running dumpbin on both object files to dump the symbol table. That should show both the emitted and the referencing function name. That's usually helpful in diagnosing these kinds of problems.

这篇关于MASM x86快速调用函数声明...如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆