How to Use Windows 64-bit Assembly Tools with Visual Studio
If you are interested in programming for Windows using assembly language, you will need some tools to help you create and run your code. In this article, we will show you how to use Windows 64-bit assembly tools with Visual Studio, a popular integrated development environment (IDE) for C++ and other languages.
The Windows 64-bit assembly tools include an assembler (ml64.exe), a resource compiler (GoRC.exe), and a linker (GoLink.exe). These tools are free and can produce executables for both Win32 and Win64 platforms. They also have some features that make programming for Windows easier, such as enhanced support for Unicode and no need for library files.
To use these tools with Visual Studio, you will need to install them and configure your project settings. Here are the steps to follow:
Download the Windows 64-bit assembly tools from their respective websites. You can find ml64.exe as part of the Visual Studio installation[^1^], GoRC.exe from https://godevtool.com/[^2^], and GoLink.exe from https://godevtool.com/[^2^]. Extract the zip files to a folder of your choice.
Create a new Visual Studio C++ project or open an existing one. In the Solution Explorer, right-click on the project name and select Build Customizations. Check the box next to masm (.targets,.props) and click OK[^1^]. This will enable Visual Studio to recognize assembly-language files.
Add an assembly-language file to your project by right-clicking on the project name and selecting Add New Item. Choose C++ file (.cpp) as the file type and give it a .asm extension instead of .cpp[^1^]. Write your assembly code in this file using ml64.exe syntax.
Add a resource file to your project by right-clicking on the project name and selecting Add New Item. Choose Resource file (.rc) as the file type and give it a .rc extension[^2^]. Write your resource script in this file using GoRC.exe syntax.
Configure your project properties by right-clicking on the project name and selecting Properties. In the Configuration Properties section, do the following:
Under General, set Configuration Type to Application (.exe) or Dynamic Library (.dll) depending on your desired output[^2^].
Under VC++ Directories, add the paths to ml64.exe, GoRC.exe, and GoLink.exe folders to the Executable Directories field[^2^].
Under NMake, set Build Command Line to GoLink /console /entry _start $(InputName).obj $(InputName).res kernel32.dll user32.dll gdi32.dll[^2^]. This will invoke GoLink.exe with the appropriate options and libraries to link your object and resource files into an executable.
Under NMake, set Rebuild All Command Line to ml64 /c /coff $(InputName).asm & GoRC /ni $(InputName).rc & GoLink /console /entry _start $(InputName).obj $(InputName).res kernel32.dll user32.dll gdi32.dll[^2^]. This will invoke ml64.exe and GoRC.exe with the appropriate options to compile your assembly and resource files into object and resource files before linking them.
Under NMake, set Clean Command Line to del $(InputName).obj $(InputName).res $(InputName).exe[^2^]. This will delete the intermediate and output files when you clean your project.
Build and run your project by pressing F7 and F5 respectively. You should see your Windows 64-bit assembly program running as expected.
We hope this article has helped you learn how to use Windows 64-bit assembly tools with Visual Studio. For more information on these tools, you can refer to their manuals and websites: