I have done this function that uses ctypes to create an object with a buffer protocol that points to a specified address:
import numpy as np
def np_buffer_from_address(shape, dtype, address):
import ctypes
return np.ndarray(shape, dtype = dtype, buffer = ctypes.c_void_p.from_address(address))
But I wanted to know if I can do this without using ctypes. If you can do it directly with numpy