On Wed, Jan 20, 2010 at 5:43 PM, Ben Fitzpatrick < bfitzpatr...@vtiinstruments.com> wrote:
> Hi everyone, > > > > I think I’m finally getting the hang of this, I seem to have gotten almost > everything in my project working thanks to Gustavo’s latest pybindgen patch. > One of the remaining things I am having difficulty with is putting > annotations on member variables of a class. I have something of the form: > > > > class foo{ > > <stuff> > > }; > > > > class baz { > > public: > > foo* var; > > } > > > > The error I am getting from pybindgen is “WrapperWarning: Return value > ‘::foo *’ error (used in baz::var [variable]): > TypeConfigurationError(‘Either caller_owns_return or > self.reference_existing_object must be given’) > > > > I know that the issue is that I need to stick an annotation on there. > Since the pointer is allocated and tracked by the underlying C++ code, I’m > pretty sure that I need to put reference_existing_object on it. I’ve tried > inserting “{‘reference_existing_object’ : ‘true’}” into the > global_annotations table, and also inserting it into the > parameter_annotations[“return”] dictionary. For kicks, I even tried both at > once. No matter what I do I can’t get rid of the error, or see it show up in > my final build, which leads me to believe there’s something I’m missing. I > went and looked up the documentation for reference_existing_object, but of > course none of their examples show how you could use it on a member > variable. What am I missing? > You are not missing anything. Annotations for member variables (pybindgen calls them "instance attributes") were not implemented. An oversight easily fixed: http://bazaar.launchpad.net/~gjc/pybindgen/trunk/revision/742 > > > Thanks, > > Ben Fitzpatrick > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig