Getting SWIG to work with C++/Python

Jakob Schiotz schiotz1 at yahoo.com
Fri Jan 7 07:29:08 EST 2000


In article <9mad4.42353$Ke.27158 at news21.bellglobal.com>,
  "Jason Maskell" <backov at nospam.csolve.net> wrote:
> Well, I bit the bullet and reinstalled VC5, and got SWIG to compile.
Now, I
> try "swig -c++ -python interf~1.cpp" and it chokes, hard. I try it
with the
> h, same thing.. I've tried variations of that, and I keep getting
loads of
> syntax errors, etc. Did it compile wrong? Is there some hidden syntax
I
> should be using? The other possibility is that since the files I'm
swigging
> are Borland C++ and SWIG itself was compiled with VC++.. But I can't
see
> that being a problem.
>
> Any help?
>
> Cheers,
> Jason
>
>

You should not run SWIG on the .cpp file, but on an interface (.i) file
that you write.  In some cases the .i file may just include the .h file,
but in most cases you need to cut and paste the declarations from the .h
file leaving out the stuff that SWIG does not understand.

There is an _excellent_ manual for SWIG at www.swig.org.  SWIG is a
rather advanced tool, and you really need to look at the manual to use
it.

I use SWIG a lot, I find it relatively easy to use, but I would not have
gotten anywhere without the manual.


Happy programming!

Jakob


--
Jakob Schiotz, CAMP and Department of Physics, Tech. Univ. of Denmark,
DK-2800 Lyngby, Denmark.  http://www.fysik.dtu.dk/~schiotz/
This email address is used for newsgroups and mailing lists
(spam protection).  Official email: schiotz @ fysik . dtu . dk


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list