title: Assembly on Windows
body: <p>I am interested in doing minimal assembly programming on Windows. No GUI, just a plain old <code>.exe</code> program that will print a few characters to the console. In order to see if it was even possible to simply compile and run assembly on Windows, I tried the following:</p>
  
  <p>test.s:</p>
  
  <pre><code>ret
  </code></pre>
  
  <p>command line:</p>
  
  <pre><code>gcc test.s
  </code></pre>
  
  <p>And I got the following error:</p>
  
  <blockquote>
    <p>In function 'main': undefined reference to 'WinMain'</p>
  </blockquote>
  
  <p>So the question is how do I go about compiling a simple assembly do-nothing program to a Windows executable? Do I need to define <code>WinMain</code> in every program? Is it a flag to <code>gcc</code>?</p>
  
  <p>I don't really care which assembler I use, but if someone knows if this is the same of different for <code>gcc</code>(<code>gas</code>), <code>masm</code> and other assemblers, that would be nice, too.</p>