title: SWIG and Mingw-64 to use with Python … not a valid Win32 application
body: <p>I want to use Swig to use my C/C++ "model-controler" application with Python HMI.</p>
  
  <p>I first test python swig simple example on my ubuntu PC and it works like a charm.</p>
  
  <p>Then I tried to do the same on a Win7-64bits with Mingw-64:<br>
  "Wrap" by using</p>
  
  <pre><code>swig.exe -python path_to_swig_examples\python\simple\example
  </code></pre>
  
  <p>in cmd window, it's generate example_wrap.c… Ok  </p>
  
  <p>Then compile under mingw terminal (personally I launch by right-click in explorer then <em>Git Bash here</em>)</p>
  
  <pre><code>gcc -c -fPIC -DWIN32 example.c example_wrap.c -I/C/Program\ Files\ \(x86\)/Python36-32/include
  </code></pre>
  
  <p>generate my objs…Ok<br>
  and link</p>
  
  <pre><code>ld -shared example.o example_wrap.o -o _example.dll
  </code></pre>
  
  <p>and I have many <code>undefined reference</code></p>
  
  <pre><code>example_wrap.o:example_wrap.c:(.text+0xe3): undefined reference to `strlen'
  example_wrap.o:example_wrap.c:(.text+0x1de): undefined reference to `strcmp'
  example_wrap.o:example_wrap.c:(.text+0x5ff): undefined reference to `strcmp'
  example_wrap.o:example_wrap.c:(.text+0x957): undefined reference to `strlen'
  example_wrap.o:example_wrap.c:(.text+0x98f): undefined reference to `strcpy'
  example_wrap.o:example_wrap.c:(.text+0x9c8): undefined reference to `strcmp'
  example_wrap.o:example_wrap.c:(.text+0xa38): undefined reference to `strlen'
  example_wrap.o:example_wrap.c:(.text+0xaaf): undefined reference to `strncpy'
  example_wrap.o:example_wrap.c:(.text+0xaf5): undefined reference to `strcmp'
  example_wrap.o:example_wrap.c:(.text+0xb11): undefined reference to `memset'
  example_wrap.o:example_wrap.c:(.text+0xb57): undefined reference to `__imp_PyUnicode_AsUTF8String'
  example_wrap.o:example_wrap.c:(.text+0xb76): undefined reference to `__imp_PyBytes_AsStringAndSize'
  example_wrap.o:example_wrap.c:(.text+0xb88): undefined reference to `malloc'
  example_wrap.o:example_wrap.c:(.text+0xbaa): undefined reference to `memcpy'
  example_wrap.o:example_wrap.c:(.text+0xc15): undefined reference to `__imp_PyUnicode_FromString'
  example_wrap.o:example_wrap.c:(.text+0xc69): undefined reference to `__imp_PyExc_MemoryError'
  example_wrap.o:example_wrap.c:(.text+0xc7c): undefined reference to `__imp_PyExc_IOError'
  example_wrap.o:example_wrap.c:(.text+0xc8f): undefined reference to `__imp_PyExc_RuntimeError'
  example_wrap.o:example_wrap.c:(.text+0xca2): undefined reference to `__imp_PyExc_IndexError'
  </code></pre>