title: Assembly sending parameters - fastcall
body: <p>I'm trying to call my asm function from c++ and send two parameters which should be saved in ecx and edx according to wikipedia regarding the fastcall calling convension.</p>
  <p>This does however not work. Am i missing something?</p>
  <p>Assembly x86</p>
  <pre><code>.model flat
  
  .code
  _TestFunction proc
  
      mov eax, ecx
      add eax, edx
      ret
  
  _TestFunction endp
  end
  </code></pre>
  <p>C++ Code</p>
  <pre><code>#include &lt;iostream&gt;
  
  extern &quot;C&quot; int TestFunction(int a, int b);
  
  int main()
  {
      std::cout &lt;&lt; &quot;Function returns:&quot; &lt;&lt; TestFunction(200,100) &lt;&lt; std::endl;
      
      std::cin.get();
      return 0;
  }
  </code></pre>
  <p>The function returns 1 and this is the registers:</p>
  <p>ECX = 00000000 EDX = 00000001</p>
  <p>Build logs:</p>
  <blockquote>
  <p>1&gt;------ Rebuild All started: Project: Tutorial, Configuration: Debug
  Win32 ------ 1&gt;<br />
  Assembling asm.asm... 1&gt;
  Main.cpp 1&gt;
  Tutorial.vcxproj -&gt; C:\Users\nilo\documents\visual studio
  2012\Projects\Tutorial\Debug\Tutorial.exe</p>
  <p>========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========</p>
  </blockquote>