Jump to content

Check out our Community Blogs


Member Since 16 Sep 2010
Offline Last Active Oct 25 2017 03:39 PM

Posts I've Made

In Topic: Intro To Win32 Assembly, Using NASM, Part 3

25 October 2017 - 03:14 PM

Sorry to bump this aged thread, but I can't seem to find an "edit" button on my original post. 


There is an important thing I realized recently: put the "use32" at the VERY TOP of the ASM file, or else ALINK will give a reloc warning, as described here


The reason for that is that (not sure why I wasn't getting this error back in 2011 when I posted this tutorial) NASM will interpret all code, INCLUDING the "extern" and "import" statements, as 16-bit. So when NASM creates a table where all the addresses of API functions are to be saved, it creates the table with all 16-bit entries. 


In summary, just put "use32" at the beginning of the .asm file, before any "import" statements, and it should assemble and link correctly. 

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download