On Wed, 29 Jul 2009 10:30:24 +0200, TGS France Alexandre <[email protected]> wrote: > Hi, > > It looks like there is nothing available in PyQt to read from a > QSharedMemory or to write into it. > How to use the sip.voidptr returned by QSharedMemory.data()?
http://www.riverbankcomputing.com/static/Docs/sip4/python_api.html#sip.voidptr > Here is a piece of code that shows the writing problem: > > /# Encode data into a buffer/ > buffer = QtCore.QBuffer() > buffer.open(QtCore.QIODevice.WriteOnly) > out = QtCore.QDataStream(buffer) > out.writeInt32(1234) > size = buffer.size() > > /# Create the shared memory/ > sharedMemory = QtCore.QSharedMemory('key') > sharedMemory.create(size) > > /# Write the encoded data into the shared memory/ > sharedMemory.lock() > *memcpy(sharedMemory.data(), buffer.data().data(), size)* # How to do > somehting like that? > sharedMemory.unlock() So... mutable_data = buffer(sharedMemory.data()) ...should give you write access to the memory. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
