Mixing Python and C: any easy way?
Carl Bevil
carl_bevil at yahoo.com
Wed Jan 15 23:15:50 EST 2003
Hey folks. I'm on a small team of programmers developing a project over a
period of several months. We normally code in C++, but are thinking it would
be nice to do part of the development in a scripting language such as Python.
The nature of our application is still going to require that large chunks of
the app still be done in C++.
So I've been looking into ways to easily interface the two languages. The
only thing I've turned up so far is SWIG. Unfortunately it doesn't seem to be
as automated as I'd like. It appears that you have to create a special
interface file for every C++ header you want to access from Python. There may
be many headers containing complicated objects in our project, and I
anticipate creating interface files would be a lot of work, and would turn
into a maintenance problem. Maybe someone out there has been in a similar
situation and can tell me whether this is a pain or fairly easy?
Thing is, I am hesitant to tell the other programmers on the team, "You have
to learn a new language, which will make development faster, but you also have
to create special SWIG files for every C++ header you want to access from this
new language, and make sure you keep these files up to date with changes you
make in your headers, etc....". We have a tight schedule (who doesn't?), so
I'm worried about efficiency.
Am I overreacting here? And is there a better way to do this? If not SWIG,
then what can do this task? Am I asking for the impossible? I've heard that
Python is supposed to be good at interfacing with C/C++. Can someone give me
some pointers that will help me out here?
Thanks!
Carl
More information about the Python-list
mailing list