[SciPy-User] Wrapping C/C++ Code

Zachary Pincus zachary.pincus@yale....
Tue Nov 3 10:25:52 CST 2009

Another option instead of SWIG, if you have a reasonably stable C API  
and a pre-built shared library exporting the same, is to use ctypes to  
call into it. This works well enough with many numeric APIs, too where  
you can allocate arrays with numpy, and then use the array's ctypes  
attribute to get at a pointer to the memory suitable for passing into  
the C code.

The downside is that (as far as I know) there's no good way to build  
pure-C libraries as part of a "python setup.py build" step (though  
some functionality along these lines might be now in the numpy  


More information about the SciPy-User mailing list