I would like to create a numpy.darray exactly at the location where a ctypes.c_void_p pointer is pointing to.
buffer_ = ctypes.c_void_p()
# magically let the API point it to a special memory location
numpy_buffer_ = numpy.ndarray(shape, dtype=dtype, buffer=buffer_)
However, I am getting the error:
TypeError: buffer is too small for requested array
I got the general idea to solve this problem like this from another thread, where it is used slightly differently:
numpy.ndarray(shape, dtype=dtype, buffer=c_void_p.from_address(address))
However, as I already have a c_void_p pointing to the correct address, I hoped I could use it.
Any ideas, why my buffer appears too small? (It also does not work, if I put a tiny shape to my ndarray)
Best,
gbrown