handle = ctypes.c_int(0)
ret = lib.XF_OpenDev(0, ctypes.byref(handle))
After handle is passed in as a pointer If it is changed, it will return a c_int or c_long. You can use handle.value to get the real python integer that can be flexibly used in python