我想从python2.7中的DLL调用此C函数
uint8_t DLL_CONV Mag(uint8_t *t1, uint8_t *t2, uint8_t *t3);
此函数将数据写入通过引用发送的数组。
到目前为止,这是我的python代码
_mag = hDLL.Mag
#_mag.argtypes =[ctypes.POINTER(ctypes.c_ubyte),ctypes.POINTER(ctypes.c_ubyte),ctypes.POINTER(ctypes.c_ubyte)]
_mag.argtypes =[ctypes.c_ubyte *100,ctypes.c_ubyte *100,ctypes.c_ubyte*100]
_mag.restype = ctypes.c_ubyte
def mag():
t1 = (ctypes.c_ubyte * 100)()
t2 = (ctypes.c_ubyte * 100)()
t3 = (ctypes.c_ubyte * 100)()
s = _mag( (ctypes.c_ubyte *100)(t1), (ctypes.c_ubyte *100)(t2), (ctypes.c_ubyte *100)(t3) )
return t1,t2,t3
我总是在s = _mag()
答案 0 :(得分:0)
我未定义argtypes
并发送像这样的数组
s = _mag( (t1), (t2), (t3) )