[PyKDE] SIP: Newbie and char buffers

Doyon, Jean-Francois jdoyon at NRCan.gc.ca
Fri Feb 2 18:06:05 GMT 2007


Hello,

I've been wrapping a free but not open-source C++ SDK on Linux using SIP.

I've achieved all that I wanted so far using fairly simple techniques, but now I've run into a problem ...

Admitedly, I don't know much about C++ (Which is why I'm wrapping it).

I have a method that looks like this:

virtual lt_uint32 read( lt_uint8 *pDest, lt_uint32 numBytes );

Where "lt_uint8 *pDest" is actually an "unsigned char *buffer" ...

(The class is an in-memory stream).

Although the compile steps work fine, When I come to use it, strange things happen ...

data = ''
stream.read(data, 512)

This does not work ... Data is still empty after the call.  Also, when I use this method, when the python interpreter stops running, it segfaults!

I tried experimenting with buffer('') for example, but that didn't work.

I suspect I'm going to have to write some custom code in the SIP file now ... But I'm not sure where to start.

This is the last bit of functionality I need! I'm so close!

Any help would be much appreciated ...

Thanks,

Jean-François Doyon
Internet Service Development and Systems Support / Spécialiste de dèveloppements internet et soutien technique
Canada Centre for Remote Sensing/Centre Canadien de télédétection
Natural Resources Canada/Ressources Naturelles Canada
http://atlas.gc.ca
Tel./Tél.: (613) 992-4902
Fax: (613) 947-2410




More information about the PyQt mailing list