C++ Modules for python: How to?

Robert Dailey rcdailey at gmail.com
Sat Jul 7 01:26:28 CEST 2007


On Jul 6, 3:06 pm, "Diez B. Roggisch" <d... at nospam.web.de> wrote:
> Robert Dailey schrieb:
>
> > Hi,
>
> > I'm interested in making a C++ library of mine usable through python.
> > Python does a similar thing with Expat (the non-validating XML
> > parser). I notice that with Expat, python is importing a C++ header
> > file into a PY file and the interface is available to python. I've
> > read through the python documentation as well as done a little bit of
> > google research and I've not been able to find a tutorial of some sort
> > on how to do this. Perhaps I just don't know the right words to search
> > for.
>
> > If anyone could lead me in the right direction (possibly an article,
> > tutorial, etc) I would greatly appreciate it.
>
> The best thing to do is to offer your C++-lib with a C-style interface.
> Then you can use python's ctypes (included since python2.5) to access
> the shared library.
>
> If you insist on using C++, you can expose the lib using several
> available wrapper generators. I know of three: SIP, Swig &
> Boost::Python. The first I've got some very good first-hand experience.
> The second is somewhat primitive IHMO. The third I never used.
>
> Use these to google in this group, you'll find plenty of stuff.
>
> Diez

How do I install SIP? I can't seem to do this. I've downloaded the
package and read the README file, but I don't see a way of installing
it on windows. I ran the configure.py file but then it generates
makefiles to run which can't be run on windows. I also attempted to
download QT but it doesn't appear to be free (it's an evaluation and I
don't feel like submitting my personal information to download it).

Am I missing something? Thank you for your reply.




More information about the Python-list mailing list