Look at the sample.c and sample.h files for C code and header, respectively.
Install mingw-w64 from:
http://sourceforge.net/projects/mingw-w64/
put mingw64\bin\ folder into path and compile it with:
In [1]:
!!gcc -c sample.c
Out[1]:
In [2]:
!!gcc -shared -o sample.dll sample.o -Wl,--out-implib,libsample.a
Out[2]:
In [3]:
import ctypes
In [4]:
ctypes.util.find_library('sample.o')
Out[4]:
Load the dll:
In [5]:
_mod = ctypes.cdll.LoadLibrary('sample')
Define a wrapper to the dll function
In [6]:
in_mandel = _mod.in_mandel
in_mandel.argtypes = (ctypes.c_double, ctypes.c_double, ctypes.c_int)
in_mandel.restype = ctypes.c_int
Use it:
In [7]:
in_mandel(1., 4., 1)
Out[7]:
For more functions look at the sample.py.
A good reference used for this notebook is:
http://chimera.labs.oreilly.com/books/1230000000393/ch15.html
from the python cookbook:
http://chimera.labs.oreilly.com/books/1230000000393/index.html
For a MS Visual C++ compiler setup see:
http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/