title: Calling C function from masm 64
body: <p>I have a problem with my assembly code (64 bit masm in Visual 2013 on win8 64). When I'm calling C function (printf), it throwing exception from ntdll.dll. What I'm doing wrong? How I can read and write data from console in 64 bit masm? Where I can find good tutorial for masm 64 bit? </p>
  
  <pre><code>extrn printf : proc
  .data
  format byte "Arg1: %d", 10, 0
  
  .code
  printData proc
  
  mov rbx, 100
  push rbx
  
  lea rax, format; format address
  push rax
  
  call printf; throw unhandled exception ntdll.dll - Access violation reading location 0xFFFFFFFFFFFFFFFF.
  add rsp, 16 ;2* 64bit value
  
  ret
  printData endp
  end
  </code></pre>
  
  <p>P.S I'm calling printData from C++ code.</p>