Python ctypes pointer to struct as identifier without member access
问题 I have two different C functions and I would like to use them with ctypes in Python. One function is establishing a connection and returns a pointer to an truct. The pointer shall be used as an argument in the second function to reuse the established connection. C Code: customStruct * connect() { customStruct *obj = connection_helper(); return obj; } void foo(customStruct * obj) { foo_helper(obj); } Python code: from ctypes import * lib = CDLL("./test.dll") obj = lib.connect() lib.foo(obj)