Visual C++ Project uses asm files


As you know, C++ project could embed asm in function. But in some cases, we want to use asm file in our project. How to do?

1, open the project, and insert existing xxx.asm file into project. Or you could generate new file and name it as "xxx.asm".

image

2, in C/C++ source code, if you want to use the function, just add declaration before using it. Please note: in C++ code, extern "C" should be added (like above image).

3, edit and save the asm function.

image

4, In asm1.asm custom project setting, add following in command line:

ml /c /Cx /coff -Zi "-Fl$(InputDir)\$(InputName).lst" "$(InputPath)"

Add following in outputs:

$(InputName).obj

image

Try to compile the asm1.asm, the asm1.lst and asm1.obj files should appear under project folder.

5, Build the solution. All done.

If there are some errors, you could try to copy the asm1.obj to "Debug" or "release" folder, if it could fix the issue, you could modify the path of command line and outputs setting of asm1.asm.


发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注