J wrote: > just to follow up. I managed to get it working by having a closer look > at the xxmodules. However, the example does the following > > typedef struct > { > PyStructBaseClass mBase; > int mValue; > } PyStructDerivedClass; > > Does anything speak agains doing this ? > > typedef struct : public PyStructBaseClass > { > int mValue; > } PyStructDerivedClass; > > It seems to work for me. The advantage is that access to the members in > that structure is easier. The .mBase is not needed ....
Well, it's C++, not C, and in C++ you wouldn't idiomatically use typedef there, but rather write struct pyStructDerivedClass : PyStructBaseClass { int mValue; }; You'll also be relying on assumptions of how single inheritance is implemented by your C++ compiler -- but that said, I've used this assumption in the past and found it to be valid for a wide range of compiler/ABIs. -- James -- http://mail.python.org/mailman/listinfo/python-list