On Wednesday 14 March 2007 09:36, Martin Albrecht wrote: > > My question, what's the most sensible way to call my C++ > > function 'do_something_with_a_reference' that takes a reference > > parameter? I came up with a clever hack -- put the following in your .pxd > > file: cdef extern from "NTL/ZZ.h": > > ZZ ZZ_deref "*"(ZZ *z) > > and then your function becomes: > > cdef do_something( ZZ *x ): > > do_something_with_a_reference( ZZ_deref(x), 1 ) > > but that's ugly. > > > > Any other ideas? > > x[0] should do the trick (as it is equivalent to *x in C) and is the > recommended way in the Pyrex documentation. But I used the deref trick so > far.
Yep, you said that in the slides in your SD3 talk. I didn't understand the point when I read the slides, but now that I see the need myself, it makes perfect sense. Thanks for repeating! -- Joel --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---