I am wondering if it is possible for the ctypes package to interface with mmap.
Currently, my module allocates a buffer (with create_string_buffer
) and then passes that using byref
to my libraries mylib.read
function. This, as the name suggests, reads data into the buffer. I then call file.write(buf.raw)
to write the data to disk. My benchmarks, however, show this to be far from optimal (time spent in file.write
is time better spent in mylib.read
).
I am therefore interested in knowing if ctypes can interoperate with mmap. Given an mmap.mmap
instance and an offset how can I get a pointer (c_void_p
) into the address space?