[C++-sig] Boost.Python: same class in several modules

Rock Lobster email at christian-gleinser.de
Tue Jul 14 16:47:48 CEST 2009


I tried to do the following:
I've got two Python modules which are both wrapped by boost.python, and both
of them share some header files, so there are several classes which are used
by both modules.

As an easy example:
- first module is called "videolib" and second module is called "videofx"
- both modules use a class called "VideoFile", which is inside a single
"videofile.h" (included by both modules)
- videolib module has a function that returns a VideoFile*.
- videofx module has a class with a method that accepts VideoFile* as a

Now I'd like to use both modules in Python, and call e.g.
videolib.createVideoFile() and then use the returned object to put it into
the, let's say, videofx.doSomethingWith(vf) method.

But the problem is that Python doesn't know that both VideoFile* types are
exactly the same, so he says "Python argument types did not match C++

Is there anything I can do to manage this situation? Or would I have to
re-engineer the library structures?

Nice greetings and thanks in advance
View this message in context: http://www.nabble.com/Boost.Python%3A-same-class-in-several-modules-tp24479797p24479797.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.

More information about the Cplusplus-sig mailing list