-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
ctypes on Windows: error calling C function that returns a struct containing 3 bools #78784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Marshalling the following C structure with ctypes in Windows (compiled with VS2015) is not working correctly. The corruption happens only if the returned structure contains 3 booleans, if I add a fourth bool to the structure than I get expected results. In linux (compiling with Gcc) the same code (with 3 booleans) work as expected. typedef uint64_t CustomHandle; typedef struct CustomHandle GetHandle(); As already mention I attached all the files to reproduce the issue with the related cmake file |
I think the problem is that FFI layer assumes that MSVC compiler will try to pass any structure less than 8 bytes in registers whereis it is not always true: |
Thanks MatteoL for the bug report, it has been fixed in 2.7, 3.6, 3.7 and master. Thanks Vladimir Matveev for the fix! |
assertEquals() is deprecated, use assertEqual() instead. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: