2
這是我試圖在python中構建包裝的代碼。ctypes <type'exceptions.TypeError'>
這是total.py文件(* C_T是長度爲7的空陣列(將內部函數來計算)中,t和Rh長度的Na陣列)
#double *initSeriesReversion(double *c_t, double *t, double *rh, int Na)
_inSR = _modi.initSeriesReversion
_inSR.argtypes = [ndpointer(ctypes.c_double * 7, flags="C_CONTIGUOUS"),ndpointer(ctypes.c_double * 100, flags="C_CONTIGUOUS"),ndpointer(ctypes.c_double * 100, flags="C_CONTIGUOUS"),ctypes.c_int]
_inSR.restype = ctypes.POINTER(ctypes.c_double * 7)
和蟒機能的研究
def ini_SR(t, rh, Na):
c_time = ctypes.POINTER(ctypes.c_double * 7)
c_freq = _inSR(c_time,t,rh,Na)
return c_time.value, c_freq
錯誤: 文件 「」,第1行,在
File "total.py", line 28, in ini_SR
c_time = ctypes.POINTER(ctypes.c_double * 7)
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected LP_c_double instance instead of _ctypes.PyCPointerType