[C++-sig] pyplusplus registration order - solution
Matthias Baas
baas at ira.uka.de
Tue Feb 14 19:37:45 CET 2006
Roman Yakovenko wrote:
>> When importing I get an error that MSpace::Space is not known
>> (MSpace::Space is an enumeration). The MSpace class gets only registered
>> much later. There is no cyclic dependency in this example as the MSpace
>> class really only contains this enumeration and nothing else.
>
> Please, try an attached file.
The above problem is now solved. Thanks!
But there's still more to do. I still get an error during import. Now
it's the registering order within one file that should be modified. I
have a class that contains some enums. In the constructor of this class,
the enum is already used. But in the pyplusplus file, the enum is
created after the class constructor. I'm not sure if this can be
resolved at all....
Here's the relevant part of the code that pyplusplus has generated (the
constructor uses MTesselationParams::PolyType which is only defined
afterwards):
typedef bp::class_< MTesselationParams >
MTesselationParams_exposer_t;
MTesselationParams_exposer_t MTesselationParams_exposer =
MTesselationParams_exposer_t(
"MTesselationParams", bp::init< MTesselationParams::TessFormat,
MTesselationParams::PolyType >((
bp::arg("format")=::MTesselationParams::kStandardFitFormat,
bp::arg("arg1")=::MTesselationParam
s::kTriangles ))[bp::default_call_policies()] );
bp::scope MTesselationParams_scope( MTesselationParams_exposer );
bp::enum_<MTesselationParams::PolyType>("PolyType")
.value("kTriangles", MTesselationParams::kTriangles)
.value("kQuads", MTesselationParams::kQuads)
.export_values()
;
...
- Matthias -
More information about the Cplusplus-sig
mailing list