在头文件test.h中有函数声明: void *test(int a,intb); 在test.cpp中如何用汇编来实现?不需要考虑实际函数的实现。 我尝试 __asm{ .text: .globl test; xxx } 但是在第一行就会报编译错误(编译器:MSVC)。
.h : void *test(int a,intb); .cpp : void *test(int a,intb) { __asm { mov eax,[a] mov ecx,[b] //......do anything u want! } } 够简单了吧.另外别忘了把GCC里面的AT&T汇编格式转成intel格式的!
整个函数用汇编来写的话,应该单独拆出来,换成 .asm 文件,用 ml /c /coff 来编译(可以下载个 MASM32 来玩玩)
64,637
社区成员
250,559
社区内容
加载中
试试用AI创作助手写篇文章吧