<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Compiling C code to dll
Look at the sample.c and sample.h files for C code and header, respectively.
Install mingw-w64 from
Step1:  Wrapping into py 3.4
Step2:  Load the dll
Step3:  Define a wrapper to the dll function
Step4:  Use it
<ASSISTANT_TASK:>
Python Code:
!!gcc -c sample.c
!!gcc -shared -o sample.dll sample.o -Wl,--out-implib,libsample.a
Explanation: Compiling C code to dll
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:
End of explanation
import ctypes
ctypes.util.find_library('sample.o')
Explanation: Wrapping into py 3.4
End of explanation
_mod = ctypes.cdll.LoadLibrary('sample')
Explanation: Load the dll:
End of explanation
in_mandel = _mod.in_mandel
in_mandel.argtypes = (ctypes.c_double, ctypes.c_double, ctypes.c_int)
in_mandel.restype = ctypes.c_int
Explanation: Define a wrapper to the dll function
End of explanation
in_mandel(1., 4., 1)
Explanation: Use it:
End of explanation
<END_TASK>