我如何通过引用传递给使用__asm的函数 [英] how do I pass by reference to a function using __asm

查看:242
本文介绍了我如何通过引用传递给使用__asm的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用VS2008,Windows7 64bit和MFC对话框基础应用程序.

Hi,

I am using VS2008, Windows7 64bit, and MFC dialog base app.

void _stdcall FuncA(int & a)
{
  a += 3;  // get error: access violation
}
void CMfcAsmTestDlg::OnBnClickedButton1()
{
  int var = 8;
   __asm
   {
    push var
    call FuncA
   }
}


推荐答案

喜欢这个,

Like this,

int var = 8;
__asm
{
    lea eax, [var]
    push eax
    call FuncA
}




您可以通过正常调用FuncA来编写一小段代码,然后启动调试器并转到Dissambler,在那里您可以看到汇编代码.




You can write a small code by calling FuncA normally and start debugger and go to dissambler, there you can see the assembly code.


这篇关于我如何通过引用传递给使用__asm的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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