[C++-sig] pybindgen: allow_subclassing option causing reference parameters to be copied?
J. Michael Owen
mikeowen at llnl.gov
Thu Jul 2 20:38:22 CEST 2009
I pulled down your bazaar branch and merged it with my own changes (I
need to use the container methods, inplace numeric operators, and
numeric operators with built in python types, so I have to keep using
my changes for now), and now reference parameters are working just
fine. Great!
Since the code I'm binding has probably thousands of reference
parameters to expose, I've written little helper methods as shorthand
for the long parameter definition. This is probably a little
specialized for what you want, but it might be helpful to include
something like these (akin to the "param" method you already have in
utils):
def refparam(cppobj, argname):
return Parameter.new("%s&" % cppobj, argname,
direction=Parameter.DIRECTION_INOUT)
def constrefparam(cppobj, argname):
return Parameter.new(ref("const %s&" % cppobj), argname,
direction=Parameter.DIRECTION_INOUT)
So on those changes I have for the pybindgen code (allowing the stuff
I mention above), I'd be happy to modify them to fit in better with
how you want pybindgen to look if you'd like to give me an idea what
you're looking for.
On Jun 30, 2009, at 6:29 AM, Gustavo Carneiro wrote:
>
> Ah, right. The thing is, the code tries to make a copy of the
> object to give to the python wrapper in case it appears the python
> code kept a reference to the wrapper.
>
> I need to fix pybindgen to, if the class has no copy constructor
> keep the wrapper->obj pointer NULL instead of giving it a copy.
>
> The fix has been pushed to the bazaar branch. See https://
> code.launchpad.net/~gjc/pybindgen/trunk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090702/9d7dd5c5/attachment.htm>
More information about the Cplusplus-sig
mailing list