title: Why do I need __declspec(dllexport) to make some functions accessible from ctypes?
body: <p>So I am learning to make use of Python ctypes module.<br>
  Here is simple C file which I compiled with gcc -shared (version 4.8) on Windows to get sample  .dll:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int addition(int a, int b){
      return a+b;
  }
  </code></pre>
  
  <p>I am now able to access it from Python like this:</p>
  
  <pre><code>&gt;&gt;&gt;from ctypes import *
  &gt;&gt;&gt;mylibc = CDLL(r"somepath\mysample.dll")
  &gt;&gt;&gt;mylibc.addition
  &lt;_FuncPtr object at 0x00000000031456C8&gt;
  &gt;&gt;&gt;mylibc.addition(2,3)
  5
  </code></pre>
  
  <p>Now I try to do same with different, bigger and more complicated .c file which contains this function:</p>
  
  <pre><code>__declspec(dllexport) void __stdcall
  flopequity(HW hero[], HW villain[], double hcounters[],
  double vcounters[], double hsums[], double vsums[], ulong board,
  __int32 lenh, __int32 lenv)
  </code></pre>
  
  <p>where HW is typedef for a struct. I compile it with GCC and can access that function as before however when I remove __declspec(dllexport) or _<em>stdcall (or both) the function is no longer accessible.<br>
  My question is what could be the reason for me being able to access the simple function from first example but me being unable to access a more complicated function.
  What are the rules for using calling conventions/</em>_declspec when compiling C code and accessing it from ctypes ?</p>