C++调用汇编

1.C++代码嵌入汇编

在C++里面嵌入汇编代码,可以使用关键字__asm{}。例如:

#include<iostream>

void math(int a, int &b)
{
	int ans = a;

	__asm
	{
		mov ans,4
	}

	b = ans;
}

void main()
{
	int a = 2;
	int b;
	math(a, b);
	std::cout << b;
}

输出结果为:

2.cpp文件调用asm文件

参考链接:https://blog.csdn.net/qq_33775402/article/details/78828235

猜你喜欢

转载自blog.csdn.net/qq_35789421/article/details/113755879