SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)
rfk
ryan at rfk.id.au
Tue Nov 25 16:43:36 EST 2008
> I'd be interested to hear about your
> experiences with both and why you switched.
Enchant has a pretty simple C API so the binding process was
straightforward with both SWIG and ctypes. The only real trick was in
passing python functions as callbacks to the C API, for which I found
ctypes a little easier to use.
The switch wasn't motivated by any problems with SWIG, but simply
because ctypes seems to have a lot of momentum on the alternate python
implementations such as PyPy, Jython etc.
As others have noted, ctypes unfortunately doesn't support C++
bindings. There was a recent post on the PyPy blog discussing options
for C++ that you might be interested in:
http://morepypy.blogspot.com/2008/10/sprint-discussions-c-library-bindings.html
Cheers,
Ryan
More information about the Python-list
mailing list