Easiest way to include C libraries

Mike Rovner mike at bindkey.com
Tue Jan 21 21:37:46 EST 2003


"Marc" <mnations at airmail.net> wrote in message
news:4378fa6f.0301211616.3b353722 at posting.google.com...
> Hi,
>
> I've been reading on the different ways to extend Python with C/C++.
> Not having done this before, I can't figure out the easiest way to
> solve my problem. I was hoping someone might have experience with
> this.

I might be not THAT bad.
IIUC, the new tool has Tcl interface. It means, you can write a Tcl script
to file,
make the tool run it and get results to a file again.
Than you have an interface very similar to telnet.

> There are various ways to extend C, and also some applications such as
> SWIG that have been written to assist with the process. Having used
> none of these, I'm not sure the best way to go.

Of cause, you can use SWIG to wrap that C interface library and have Python
interface to the tool!
If that is what you want, you have again choose among
- wrapping .h files semi-automatically with SWIG,
- write interface on Pyrex (near Python syntax) manually or
- write interface on C++ manually (using boost.python).
The choice mainly depends on the amount of interface you want to expose and
experience you (want to) have.

Despite lack of data, I can suppose that Pyrex will be easiest/fastest way
for you if the Tcl approach isn't enough.

Mike

SWIG www.swig.org
Pyrex http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
boost.python www.boost.org








More information about the Python-list mailing list