[C++-sig] Py++ issues, plus switching from Swig
Roman Yakovenko
roman.yakovenko at gmail.com
Wed Aug 30 20:42:53 CEST 2006
On 8/30/06, Nicolas Tessore <wz_ at gmx.net> wrote:
> Hello, I hope someone can help me out:
>
> I am relatively new to Python, and not too experienced in C++.
> My situation is the following: I am trying to add Boost.Python
> bindings to a library consisting of about a hundred includes,
> weighting 60Megs. It is heavily relying on inheritance, in fact
> all classes derive from one base.
>
> Now the tricky bit: The lib uses templates a _lot_. The small
> part that is currently included in a Swig wrapper already
> contains 800 specific template conversions.
Py++ was born to solve such problems :-)
> Could anyone give me a hint in the right direction
I will try.
1. Documentation:
http://language-binding.net/pyplusplus/documentation/how_to.html#how-to-automatically-export-template-functions-class
2. Examples:
Using Py++ I exposed next libraries: date_time, boost.random, crc
and rational
including unit tests. Basically all these libraries are "one big
template".
I used different approaches to export them.
Here you will find more information and examples:
http://language-binding.net/pyplusplus/examples/boost/boost.html
You can find scripts that exports these libraries here:
http://svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/examples/pyboost_dev/dev/
Did these help? If not, you can take a look on BGL-Python package(
Python bindings for Boost Graph Library using Boost.Python ). BGL-Python
was not created with Py++, but still it could be a good example, how to expose
highly template library using Boost.Python.
P.S. Small tip: expose your code using 2 phase approach:
1. Generate C++ code that instantiate your templates.
2. Feed generated code to Py++.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list