[C++-sig] Can a module reference a class exposed in another module?
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Fri Mar 10 07:42:23 CET 2006
--- Kelly Burkhart <kelly.burkhart at gmail.com> wrote:
> Given two Boost Python modules, can one contain a funtion which accepts as a
> parameter an instance of a class defined in the other? For instance, if
> module A exposes class X, could I create a module B that can convert the
> python representation of C back to it's c++ representation:
>
> import A
> import B
>
> x = A.X()
> B.myfun( x )
Yes, this works. The Python-C++ converters are stored in a central registry.
You just have to ensure the module defining a conversion is imported before the
converters are used (as you do above). This feature is called cross-module
support.
Cheers,
Ralf
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Cplusplus-sig
mailing list