There is a function from a DLL (C language) link("parameters", &connection); which takes a string parameter and initializes a connection.
There is a function connect(connection), where connection is the object initialized with a call to link().
I pass Python connection object to function connect() as an argument
connection_t = ctypes.c_uint32
link = mydll.link
link.argtypes=(ctypes.c_char_p, ctypes.POINTER(connection_t) )
connect = mydll.connect
connect.argtypes=(connection_t,)
...
connection = connection_t()
link ("localhost: 5412", ctypes.byref(connection))
...
But if I transfer the ‘connection’ object to any other function of mydll library, the function returns a value, but the value is incorrect.
func=mydll.func
status_t=ctypes.c_uint32
status=status_t()
func.argtypes=(ctypes.c_ulong,ctypes.POINTER(status_t))
result=func(connection, ctypes.byref(status))
In this example result=0, but in the C-variant of this code I receive a correct value (not 0)
Why?
Based on your comment describing the C apis:
Since func takes a pointer to a connection type, the code should be something like: