[C++-sig] New to Py++

Roman Yakovenko roman.yakovenko at gmail.com
Sun Mar 30 19:13:47 CEST 2008

2008/3/30 Rolf Schlup <rschlup at highspeedcrow.ca>:
> Hi all,

Good evening

>   I'm new to Py++ and I need to create bindings for a Visual Simulation
> control library for the company I work for.  The library consists of over
> 200 classes of which 50 or need to be "exposed" to be usable.  I've tried
> the Py++ GUI, but the C++ code I get from it doesn't compile.

Py++ GUI was created to suite single goal: to show what code generates
Py++, without customization. You can use it almost as-is in small
projects or when you just start with Boost.Python.

> There is one
> main interface class – VSControl -  that has methods for returning
> references to members ( mostly of other classes ).  Some of the classes have
> forward referencing of their dependencies which causes the C++ to completely
> haywire and I'm thinking it has something to do with how Py++ generates the
> wrapper code.

Well, you can expose forward declarated classes as opaque type. I
think that Py++ doesn't support thi use case. Normally what you want
is to expose that classes too.

In order to do this, you need to create header file, that will include
all relevant files and than to path is to Py++

> I'm also having a lot of issues with Call Policies. Mainly,
> the ones that have with return of reference types are giving me warnings
> when I generate the C++ code.  I've been using the followingcode, but the
> resulting C++ code only compiles when I manually add the necessary header
> files to the generated code.

I guess this errors relaed to forward declarations. Try to pass single
header file, built as described above.

>  But, then when I try to import it, I get
> unresolved reference errors.

I think this error is related to your environment. Use "dependency
viewer" to verify that your dll can load others.

>If I try to add all necessary files to the
> builder lines, the warnings and compiler errors increase exponentially.
> Again, any help or examples that can yield usable binding code will be
> appreciated.

I need more specific error description. From my experience it is
better to start from something small, just few classes. To get to the
point you can import and use few simple exported classes and than
start to add other classes and functions.

Roman Yakovenko
C++ Python language binding

More information about the Cplusplus-sig mailing list