谢谢了。
解决方案 »
- vs2008 编译出的dll,如何不让它调用msvcr90.dll
- vs2010如何选择不使用net4.0或者2.0,其实就是不使用net行不行
- 初学MFC打算做一个通用的记牌器外挂
- 'AfxSetResourceHandle' : undeclared identifier
- 【状态栏 按钮】高手帮帮忙
- Creatprocess输出重定向的问题
- *********** 第一次亲密接触 --- 压缩 !***********
- 怎么样将非字符或字符串数据转换成为字符或字符串??
- 是不是只要有数据发到串口,MSComm控件的OnComm函数就一定会捕捉对应的事件?
- 各位帮帮忙,看看这个LINK错误,怎么解决
- 为什么我的鼠标取词程序只在VC窗口中有效?(附代码)
- 如何画一根又细又不褶皱的线?
_asm
{
写你汇编的代码
}
写几个.asm文件(在其中提供函数)
在vc中调用
还有一种,就是单独写一个汇编模块,并用汇编编译器编译成obj文件,再由VC调用,这很复杂,还需要很多要领,足可以写一个专题。
签名:jmcooler
签名:jmcooler
然后在vc中调用它们。如何做到这点呢、
不巧,我想知道 的是第二种方式的。
1. create an ASM file
;;;;;;;;;;;;; asmsrc.asm:
.386
.model flat, stdcall
option casemap :none
.codemyasmproc proc dw1:DWORD,dw2:DWORD
mov eax,dw1
add eax,dw2
ret
myasmproc endp
end
;;;;;;;;;;;;end of asmsrc.asm2. create a VC project name: useasm, type console application, A "Hello World" application3. move the asm file to your project directory, then in VC project menu->Add to Project...->Files...
Files of type change to "all files", then you can select the asmsrc.asm, and click OK4.in workspace window, FileView tab, select asmsrc.asm, right click to select "settings..." menu, custom build tab, put the following in commands edit box :
d:\masm32\bin\ml.exe /nologo /coff /Zf /c /Sa $(InputName).asm
put the following in Outputs edit box:
$(InputName).obj5.edit your useasm.cpp as the following:
//////////////////////useasm.cpp///////////////////////////////
#include "stdafx.h"
#include <windows.h>
extern "C" int __stdcall myasmproc(DWORD d1,DWORD d2);
int main(int argc, char* argv[])
{
printf("test of using cpp and asm together, if it works, it is done by masterz,otherwise I don't know who write this^_^\n");
int ret=myasmproc(22,33);
printf("ASM result:%d\n",ret);
return 0;
}//////////////////////end of useasm.cpp///////////////////////////////6. build the project and run it, it works.notes: I assume you have installed masm32V6(you can get it from http://www.movsd.com/masmdl.htm) at D:\masm32