I have a string buffer: b = create_string_buffer(numb)
where numb
is a number of bytes.
In my wrapper I need to splice up this buffer. When calling a function that expects a POINTER(c_char)
I can do: myfunction(self, byref(b, offset))
but in a Structure:
class mystruct(Structure):
_fields_ = [("buf", POINTER(c_char))]
I am unable to do this, getting an argument type exception. So my question is: how can I assign .buf
to be an offset into b. Direct assignment works so .buf = b
, however this is unsuitable. (Python does not hold up to well against ~32,000 such buffers being created every second, hence my desire to use a single spliced buffer.)