Wrapping a C library in Python

Benji York benji at benjiyork.com
Fri Nov 19 04:26:48 CET 2004


Roy Smith wrote:
> I've got a C library with about 50 calls in it that I want to wrap in 
> Python. 

I'd recommend ctypes (http://starship.python.net/crew/theller/ctypes/).
     It is very easy to use and multi-platform.

I have a small project that provides a DB API 2.0 interface to the ODBTP
(http://odbtp.sf.net) library.  See http://benjiyork.com/odbtp.html
(beware programmer-web-design ahead) for the code (LGPL).  It might
serve as an example to get you on your way.

BTW, if anyone is interested, I hope to have a much improved version of
the wrapper ready in a few weeks to be included in the official ODBTP
distribution.
-- 
Benji York
benji at benjiyork.com






More information about the Python-list mailing list