Creating a restype supporting type
Brought to you by:
theller
Hi,
Adding support for classes to be sent as an argument using the argtypes attribute and from_param(...) method seems pretty straight forward. Can a similar extension be done to support the restype attribute, or will the errcheck attribute be needed to do this conversion on the result?
More specifically I'd like to convert from ctypes arrays to NumPy arrays on the fly when calling a DLL function.
Thanks,
Jens
Since ctypes is now distributed as part of Python, such a request must go into the Python tracker at bugs.python.org.
However, the 'callable as restype' protocol is broken because it only works when the foreing function returns an integer; it will not work for functions returning pointers when sizeof(int) != sizeof(void *)'. A new protocol must be developed for this to work in full generality.