swig or something else....

Lyle Johnson lyle at knology.net
Sat Jul 6 12:19:35 EDT 2002


"tALSit" <talsit at talsit.org> wrote in message
news:3d26f83a at dnews.tpgi.com.au...
> Hi, I'm trying to interface a system i made in C++ with python using swig.
> Ok, i've got it working, but I find it pretty ugly. Actually, way ugly.

<snip>

> Is this a limitation of swig, python or am I doing it wrong?

You're doing it wrong ;)

Read the SWIG documentation on generating shadow classes for Python, which
will give you the result you're looking for. More specifically, if you
process your SWIG interface file with the "-shadow" command line option,
e.g.

    swig -c++ -python -shadow my_module.i

you should end up with both the C++ wrapper source code (something like
"my_module_wrap.cxx") and a shadow class module (something like
"my_module.py").

Hope this helps,

Lyle





More information about the Python-list mailing list