[C++-sig] Pyste suggestion: handling void * arguments

Niall Douglas s_sourceforge at nedprod.com
Sun Nov 2 01:26:21 CET 2003

On 1 Nov 2003 at 15:49, Nicodemus wrote:

> >Sorry, I wasn't being clear. If you declare a type (can't be void *)
> >to be opaque under BPL, then you don't define it. You just do:
> >
> >struct void_ptr;
> >
> >... and that's it. Best to leave it undefined because then failing to
> > set return_opaque_pointer policy causes a compile-time error and
> >until you add the array-indexed policy setting, we need errors where
> >at least one overload returns void *.
> I still don't understand you, sorry. 8(
> You said (in the quote above) that if you declare a type to be opaque
> under BPL, it's better that you don't define it, because if you forget
> to set return_opaque_pointer it will cause compile-time errors. What I
> don't understand is how can you declare it "to be opaque under BPL"
> *without* setting its policy...

You declare it to be opaque using 
BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID somewhere high up after the 
#include <boost/python.hpp>

> >See the multithreading patch to invoke.hpp I posted here a week or so
> > ago. You'll note the care I went to to avoid copy construction in
> >the parameters (returns may need it too, though that's rare).
> Hmm, can you help then with the implementation of this wrappers then?
> 8) It would be greatly appreciated.

As it just happens, I've finally fixed the last of the problems with 
casting out the void *'s. I'll send you a copy of my altered pyste in 
full to your new email address - I would recommend you run a visual 
diff viewer between yours and mine and see the changes I've made (eg; 
Beyond Compare). Almost certainly you could improve them with your 
superior knowledge of pyste's internals.

If you have any problems at all, email me. I work late so 5am for me 
is about midnight for you.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 208 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20031102/32f5b326/attachment.pgp>

More information about the Cplusplus-sig mailing list