c# - VOID Pointer for C DLL written in CTYPES -
i attempting convert c# program python. dll wrapped in c, , have been able use ctypes on functions having issues 2 remaining functions, similar.
the function
long setme(long dev, byte length, structure_settings structuresettings, void* data, dword datasize);
parameters dev - input length - input structuresettings - input data - ouput datasize - input
i able run function , dll respond not return values. how should deal void pointer return? want stay in ctypes realm.
here code dump structure information
class structure_settings(structure): _fields_ = [ ('t', c_byte), ('c', c_byte), ('i', c_byte), ('reserve', c_byte), ('dev1', c_byte), ('dev2', c_byte), ('dev3', c_byte), ('dev4', c_byte)] main code.... dev = 0 length = 1 datasize=4 data = ctypes.c_uint * datasize datapointer = data() structuresettings = structure_settings() structuresettings.t = 0x01 structuresettings.c = 0x0 structuresettings.i = 0x4 structuresettings.dev1 = 0x0 structuresettings.dev2 = 0x0 structuresettings.dev3 = 0x0 structuresettings.dev4 = 0x0 getfuncdll = localdll.setme getfuncdll.argtypes = [c_long, c_int, ctypes.pointer(structure_settings), c_void_p, c_ulonglong] getfuncdll.restype = c_long getfuncdllreturn = getfuncdll(dev, length, structuresettings, data, datasize) getfuncdllreturn....for error return codes data value looking for.
the solution problem deleting following lines:
getfuncdll.argtypes = [c_long, c_int, ctypes.pointer(structure_settings), c_void_p, c_ulonglong] getfuncdll.restype = c_long
Comments
Post a Comment