Verify your library linkage order, because python boost library need to be the first one, for some reasons of types resolve.
BR On Tue, Jul 14, 2009 at 12:15 PM, William Ladwig<wlad...@wdtinc.com> wrote: > Are you using the static or dynamic version of the boost python library? > This looks similar to a problem a coworker had and switching to the dynamic > version of the library fixed his problem. According to the documentation, > the dynamic version of the library "contains a type conversion registry. > Because one registry is shared among all extension modules, instances of a > class exposed to Python in one dynamically-loaded extension module can be > passed to functions exposed in another such module." > > Also, if you organize your extension modules to be used within packages, you > can use __init__.py magic to load any extension classes before using them. I > had to do this once when I defined a base class in one extension module and > subclassed it in another. I believe the dynamic version of the boost python > library is required for this to work. > > Regards, > > Bill > > > > -----Original Message----- > From: cplusplus-sig-bounces+wladwig=wdtinc....@python.org > [mailto:cplusplus-sig-bounces+wladwig=wdtinc....@python.org] On Behalf Of > Rock Lobster > Sent: Tuesday, July 14, 2009 9:48 AM > To: cplusplus-sig@python.org > Subject: [C++-sig] Boost.Python: same class in several modules > > > Hello, > > 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 > parameter. > > 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++ > signature". > > 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 > Chris > -- > 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. > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig