Blog Archives

Tutorial: SWIG Python Setup

Reviewing C/C++ was somewhat fun. Though more restrictive than Python, macros and classes are delightful. Only when I do STL will I need quick references, otherwise most basic C++/STL is simple. Python seemed to take much longer to learn, probably just more constructs/numpy.

C++ fits performance needs, and more standard OpenCL code. But I like developing in Python. So some options interfacing Python and C (and related optimizing sw) include: Elmer, swig, Shed Skin, unladen swallow, psyco, pyrex.

SWIG documentations weren’t uniform and some outdated parts differed from example files, but the code bits and comments were very helpful. I spent more time finding where’s the install help then actually installing and using C functions.

Extract brebuilt 32bit swigwin-2.0.0 (no install): http://www.swig.org/download.html

Set system ENV variables (this python is XX=26):
PYTHON_INCLUDE: C:\dev\PythonXX\include  (has python.h)
PYTHON_LIB: C:\dev\PythonXX\libs  (has pythonXX.lib)

Read the rest of this entry