Easiest way to include C libraries

Marc mnations at airmail.net
Tue Jan 21 19:16:50 EST 2003


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 am developing an automated tool to perform testing on several
different pieces of hardware. I interface with them, configure them,
and then read the results. All of these tools have direct telnet
interfaces that I simply send instrument specifics commands to in
order to configure and read results.

However, a new tool that I need to integrate does not provide a direct
interface. Instead, it provides libraries that I must reference in
order to interface with the box, and guess what, Python is not
included. Among the languages included are C and Tcl/Tk library files.
In reading, it appears that extending C has the most written about it.
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.

Basically I have to include a bunch of header files (.h for C) or .dll
files (for Tcl) and be able to access them from Python code. These
files are quite large, so any manual intervention will be time
consuming. The new release of Python mentioned some new ways of
extending it, but I'm not sure how many people have used these new
functions or what problems they might have.

Any advice or suggestions would be much appreciated.

Thanks ahead of time,
Marc




More information about the Python-list mailing list