python and C++?

Totte Karlsson mtk at u.washington.edu
Mon May 6 23:18:35 EDT 2002


Hi,
Help with getting started wrapping the library with boost would be very much
appreciated!
However, before that I have some additional questions. Maybe I need to
change some stuff in my library.

1) My libraries links to some other rather big C++ libraries. How will that
be handled? I have the headers and dll.s and lib files for these libraries.
Is that enough?

2) I use templates in my code, is that supported? Which lead to the next
question. Is STL supported? I use that a lot..(maybe this is answered
somewhere in the documentation?)

3) Documentation? will there be better documentation in the future? I have
looked at SWIG and it seems to be pretty well documented.

4) I'm using the Borland compiler. Is that OK?

regards
totte
ps: I'm kind of excited getting a python (or tcl or perl) interface. I
realize I should have done that years ago! but I did not know that python is
pretty easy to learn.. which is nice!

"David Abrahams" <david.abrahams at rcn.com> wrote in message
news:ab48hn$l5f$1 at bob.news.rcn.net...
>
> "Totte Karlsson" <mtk at u.washington.edu> wrote in message
> news:ab42mt$2ati$1 at nntp6.u.washington.edu...
> > Thanks I'll test boost,
> > How about SWIG? is boost preferable? any opinions?
>
> SWIG's approach is very different. Being the designer of Boost.Python,
I'll
> let others comment on what's preferable. My sense is that SWIG has very
> different strengths.
>
> > I read that you can't wrap C++ functions which return pointers? sounds
> like
> > a big limitation to me. My classes return pointers all the time.. is
there
> a
> > workaround?
> > I want to use the simplest and most versatile..
>
> Boost.Python v2 supports pointer return types, but that's still in a
> pre-release phase, mostly due to missing documentation. Several people are
> using it successfully to wrap major C++ projects. I can help you get
started
> with that, if you like.
>
> To look at Boost.Python v2, get the current boost CVS state and examine
>
> $(BOOST_ROOT)/libs/python/doc/v2
>
> Examples are available in the following files located at
>
> $(BOOST_ROOT)/libs/python/test
>
> newtest.py m1.cpp m2.cpp
> test_builtin_converters.py test_builtin_converters.cpp
> test_pointer_adoption.[py/cpp]
> callbacks.[py/cpp]
> virtual_functions.[py/cpp]
> bpl-test back_reference.[py/cpp]
> bpl-test implicit.[py/cpp]
> bpl-test data_members.[py/cpp]
>
> In Boost.Python v2, the object referenced by a returned pointer is copied
by
> default, but you can instead create a Python object which holds a
reference
> to any of the wrapped function's arguments to keep the pointee alive.
>
> -Dave
>
> > /totte
> >
> > "David Abrahams" <david.abrahams at rcn.com> wrote in message
> > news:ab3mgb$mgc$1 at bob.news.rcn.net...
> > >
> > > "Totte Karlsson" <mtk at u.washington.edu> wrote in message
> > > news:ab1r85$1u8s$1 at nntp6.u.washington.edu...
> > > > Hi,
> > > > Is there any good texts about how to interface to a windows dll with
> > > python?
> > > > I'm a total beginner of python.
> > > > I'm a C++ programmer and what I want is to make a DLL and interface
to
> > > that
> > > > one with python.
> > > > Say for example, I have a C++ class, called mtkMatrix. Is it then
> > possible
> > > > to allocate a mtkMatrix in a python script and acess its class
member
> > > > functions?
> > > > thanks
> > > > /totte
> > >
> > > Boost.Python was specifically designed to address your needs
> > > (www.boost.org/libs/python/doc/). If you need help getting started,
> please
> > > direct further questions to the C++-sig:
> > > http://www.python.org/sigs/c++-sig/.
> > >
> > > HTH,
> > > Dave
> > >
> > > P.S. I strongly recommend using the latest boost CVS state
> > > (http://sourceforge.net/cvs/?group_id=7586) rather than the current
> > release
> > > version.
> > >
> > >
> >
> >
>
>





More information about the Python-list mailing list