Hallo!
I want a blob object which I can pass around in python and from time to time give it to a C++ function to write to.
ctypes seems the way to go but I have problem with the python standard functions.
For example:
>>> import ctypes
>>> T=ctypes.c_byte * 1000
>>> blob = T()
>>> ctypes.pointer(blob)
<__main__.LP_c_byte_Array_1000 object at 0x7f6558795200>
# Do stuff with blob data through the pointer in C++
>>> f = open('test.bin', 'wb')
>>> f.write(blob)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument 1 must be string or buffer, not _ctypes.ArrayType
I would really like to avoid copying the data if not necessary.
Thanks