YASM integration with Visual Studio 2010, 2012 and 2013
YASM is a great assembly compiler, it supports a lot of instruction sets, assembler syntaxes, output formats, … so since Visual Studio started to use the compiler intrinsics for some versions, in my case, for x64 code, I switched to use YASM as I don’t want to mind about different syntaxes or weird and crazy compiler keywords, I just want to create a single .asm file and rule all platforms!
As if all this was not enough, it can be integrated with Visual Studio, just unzip the package vsyasm and follow a few steps given in a readme.txt.
For the 2008 version, it worked fine but recently, I tried with Visual Studio 2010 and the latest YASM v1.3.0 but all I got, where error messages. Time for investigating it!
I checked the command line used by Visual Studio for calling YASM and quickly saw it was a problem with a parameter. YASM expected the parameter “-f” to be win32 or x64 but in newer Visual Studio versions (2010, 2012 and 2013), Win32 is used instead win32 so it caused the error.
I spent some time “googling” for it and I found that the issue was already reported and fixed by a patch on 2014-October-05:
- #276 – Format Win32 fails, default platform name in VS
- #278 – Integration with Microsoft Visual Studio broken for Win32 configuration
So why it was failing then? Simple, the binary package I downloaded from the official YASM web site was compiled on 2014-August but the issue was fixed some months later.
At this point, I didn’t spend much time looking for a vsyasm binary compiled after 2014-October, I just went to the Git repository and downloaded a full copy of the source code (as of 2015-June-09). I thought it was very straightforward to compile it but well, sometimes I’m wrong :). It took me like 1 hour till I could build YASM with Visual Studio 2010. Finally, I got two packages, one for 32bits and other for 32/64bits, so I used them on my project and bingo! they worked fine as the patch promised!
I imagine that sooner than later, I new build will be available on the official web site that using recent code, will fix this and other bugs but in the meantime, I think it can help you (saving your time trying to compile it!) if I upload them ready to be used: