Bridging Python and C
Dave Angel
davea at ieee.org
Thu Jul 23 19:52:22 EDT 2009
Mohan Parthasarathy wrote:
> Hi,
> I am a newbie. It looks like there are quite a few ways to bridge Python and
> C. I have a bunch of C code and I just need Python wrappers for it. If i
> google for this I get SWIG, Boost etc. And I also see
>
> http://www.python.org/doc/2.5.2/ext/intro.html
>
> What is the recommended way for doing this ?
>
> thanks
> mohan
>
>
I think the real question to ask is what form is your C code in. If
you're in Windows, and it's compiled into DLL's with documented exports,
then I'd start by using ctypes to access a few of the exports. If that
seems too hard, you might try SWIG or another automated tool, to parse
the headers and generate wrappers. But if you haven't done it first by
hand, you might find the automated tools very hard to figure out.
DaveA
More information about the Python-list
mailing list