title: How is a C extension compiled with the correct native calling convention?
body: <p>Suppose we're writing a CPython extension module in C.</p>
  
  <p>When defining an extension, we are required to supply a <code>PyMODINIT_FUNC PyInit_&lt;module_name&gt;(void)</code>. Nowhere in this declaration is a native calling convention specified.</p>
  
  <p>Whether on Linux or on Windows, how can the extension developer ensure that the <code>PyInit_</code> function is compiled using the correct calling convention, so that the interpreter calls it successfuly during runtime? Is there some magic in the Python headers that takes care of this for us? Or something else?</p>
  
  <p>The same question applies to native functions contained in the extension module, and exposed to Python wrapped as function objects. How do we ensure that these are compiled in a manner compatible with the Python interpreter calling convention?</p>