c_double_p = POINTER(c_double)


class darray(Structure):
    _fields_ = [('v1', c_int), ('v2', c_double_p)]

@classmethod
def fromnp(cls, a):
    return cls(len(a), a.ctypes.data_as(c_double_p))
lib = CDLL('./tmp.so')
lib.test.argtypes = POINTER(darray), POINTER(darray)
Numpy array interface with ctypes function