[PyQt] banging my head on returning short* as void*

Diez B. Roggisch deets at web.de
Sat Aug 29 19:42:47 BST 2009


Hi,

I'm trying to wrap a method with the following signature:

		virtual const u16* getIndices() const

where u16 is typedef'd as simple unsigned short.

Actually, what I'm really just need is a void* here - the indices are 
passed to some other function which takes them as such.

So I tried various things - just giving the above signature makes sip 
fail (understandably) with

sip: irr::scene::SMeshBuffer::getIndices() unsupported function return 
type - provide %MethodCode and a C++ signature
error: command 
'/Library/Frameworks/Python.framework/Versions/2.6/bin/sip' failed with 
exit status 1


So I tried altering the return-type to void*, what made GCC fail with


cc1plus: warning: command line option "-Wstrict-prototypes" is valid for 
C/ObjC but not for C++
sipirrlichtirrsceneSMeshBuffer.cpp:37: warning: deprecated covariant 
return type for ‘virtual void* sipirr_scene_SMeshBuffer::getVertices() 
const’
../irrlicht-1.5_svn/include/CMeshBuffer.h:47: warning:   overriding 
‘const void* irr::scene::CMeshBuffer<T>::getVertices() const [with T = 
irr::video::S3DVertex]’
sipirrlichtirrsceneSMeshBuffer.cpp:40: error: conflicting return type 
specified for ‘virtual void* sipirr_scene_SMeshBuffer::getIndices() const’
../irrlicht-1.5_svn/include/CMeshBuffer.h:77: error:   overriding ‘const 
irr::u16* irr::scene::CMeshBuffer<T>::getIndices() const [with T = 
irr::video::S3DVertex]’
sipirrlichtirrsceneSMeshBuffer.cpp: In member function ‘virtual void* 
sipirr_scene_SMeshBuffer::getVertices() const’:
sipirrlichtirrsceneSMeshBuffer.cpp:105: error: invalid conversion from 
‘const void*’ to ‘void*’
sipirrlichtirrsceneSMeshBuffer.cpp: In member function ‘virtual void* 
sipirr_scene_SMeshBuffer::getIndices() const’:
sipirrlichtirrsceneSMeshBuffer.cpp:150: error: invalid conversion from 
‘const void*’ to ‘void*’
irr_scene.sip: In function ‘PyObject* 
meth_irr_scene_SMeshBuffer_append(PyObject*, PyObject*)’:
irr_scene.sip:1062: warning: comparison between signed and unsigned 
integer expressions
irr_scene.sip:1065: warning: comparison between signed and unsigned 
integer expressions
error: command 'gcc-4.2' failed with exit status 1



I found sipConvertFromVoidPtr, but don't know how to really use that.

Any suggestions?

Diez


More information about the PyQt mailing list