python - how to get C type definition string from ctypes object? -
i want generic function can cast ctypes object cffi object. might looks below
def ctypestocffi(ctypes_obj): return ffi.cast(get_type_definition(ctypes_obj), ctypes_obj) get_type_definition(ctypes.c_int)=='int' get_type_definition(ctypes.c_int*10)=='int[10]' #or 'int[]'
i've thought ctypes should have kind of function, far know doesn't. function needs work structures, pointers , general c type object.
does know function i'm looking for? or there reason explains why kind of functions not implemented in ctypes?
Comments
Post a Comment