How can I pass numpy array to c++ double(**) pointer array inside a c++ dll using python ctypes?
My c++ function definition looks like this:
int do_calc(unsigned short** input_array)
{
//doing something with array
}
I tried calling from python in 2 ways:
1.
libhandle = ctypes.CDLL(library_path)
libhandle.do_calc.argtypes = [ctypes.c_void_p]
libhandle.do_calc.restype = ctypes.c_int
//np_array: python numpy array
error_code = libhandle.do_calc(np_array.ctypes.data_as(ctypes.c_void_p))
libhandle = ctypes.CDLL(library_path)
libhandle.do_calc.argtypes = [ctypes.c_void_p]
libhandle.do_calc.restype = ctypes.c_int
//np_array: python numpy array
int_pointer = ctypes.POINTER(ctypes.c_ushort)
error_code = libhandle.do_calc(np_array.ctypes.data_as(int_pointer))
But I am getting this access error in both:
OSError: exception: access violation reading 0x000001C89A480000