On Wed, Nov 17, 2010 at 3:35 PM, Grant Edwards <inva...@invalid.invalid> wrote: > On 2010-11-17, Mark Crispin <nos...@panda.com> wrote: > > Hey, it's the IMAP guy! Get 'im! > >> I have a Python module written in C that interfaces with an external >> C library. Basically, the project is to make it possible to use that >> library from Python scripts. If you know who I am, you can guess >> which library. :) > > Have you looked at ctypes? It's not suitable for all libraries, but > it can often obviate the need to write any C code: > > http://docs.python.org/release/2.6.6/library/ctypes.html#module-ctypes
This. You may also want to check out [0] and [1], which use ctypes and generally make short work of writing C bindings. For a more complete example, see [2]. Geremy Condra [0]: http://code.activestate.com/recipes/576731-c-function-decorator/ [1]: http://code.activestate.com/recipes/576734-c-struct-decorator/ [2]: http://gitorious.org/evpy -- http://mail.python.org/mailman/listinfo/python-list