[C++-sig] BPL and Py_Clear()
David Abrahams
dave at boost-consulting.com
Mon Jun 13 14:40:54 CEST 2005
"Niall Douglas" <s_sourceforge at nedprod.com> writes:
> On 12 Jun 2005 at 15:25, David Abrahams wrote:
>
>> > As it turned out, pyste already supported auto_ptr. And it also
>> > seems that BPL treats auto_ptr quite sensibly, so it "just works".
>> > Wish I had known as it would have saved me a day's work :(
>>
>> You could have taken my word for it :)
>
> Unfortunately Dave what's easy to you is not so easy for the rest of
> us mere mortals. You have previously told me to do things which I am
> sure are very easy for you, but took me days of head scratching.
> Hence you see my hesitation!
>
>> > My current problem is when running through virtual function wrappers
>> > in that call_method<> tries converting an unsigned int * to an
>> > unsigned int which I don't want. I tried putting ptr() round it like
>> > this:
>> >
>> > void setData(FX::FXColor* p0, FX::FXuint p1) {
>> > call_method< void >(py_self, "setData", ptr(p0), p1);
>> > }
>> >
>> > (here FXColor is a typedef for unsigned int)
>> >
>> > ... but BPL won't take pointers to integral types in ptr(), and thus
>> > I can't see how to pass the pointer as-is.
>> >
>> >
>> > Why doesn't BPL's ptr() accept pointers to integral types?
>>
>> Think about how you would implement such a thing. What would a
>> an overriden virtual function written in Python see?
>
> A single item of whatever type eg; long * would mean the python code
> sees a python integer.
I'm confused now. If you pass an int* without wrapping it in ptr()
that's exactly what happens, right?
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list