This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay.sajip
Recipients Matt.Clarke, amaury.forgeotdarc, meador.inge, vinay.sajip
Date 2015-06-10.22:25:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433975113.51.0.20953299694.issue17310@psf.upfronthosting.co.za>
In-reply-to
Content
Although Matt was able to work around his problem, this problem seems to still be present in 2.7 as well as all 3.x versions. I think I've found the cause of the problem: in 64-bit code, the calling conventions for passing structures by value are different. From this page:

https://msdn.microsoft.com/en-us/library/zthk2dkh(v=vs.90).aspx

I would point to "Structs/unions of size 8, 16, 32, or 64 bits and __m64 will be passed as if they were integers of the same size. Structs/unions other than these sizes will be passed as a pointer to memory allocated by the caller. For these aggregate types passed as a pointer (including __m128), the caller-allocated temporary memory will be 16-byte aligned."

The code in ffi_prep_incoming_args_SYSV (see https://hg.python.org/cpython/file/a1b76c1c3be8/Modules/_ctypes/libffi_msvc/ffi.c#l368) assumes (see lines 399, 402) that all value parameters are always passed inline on the stack - which is plainly not as per the documentation I linked to, for 64-bit code.
History
Date User Action Args
2015-06-10 22:25:13vinay.sajipsetrecipients: + vinay.sajip, amaury.forgeotdarc, meador.inge, Matt.Clarke
2015-06-10 22:25:13vinay.sajipsetmessageid: <1433975113.51.0.20953299694.issue17310@psf.upfronthosting.co.za>
2015-06-10 22:25:13vinay.sajiplinkissue17310 messages
2015-06-10 22:25:12vinay.sajipcreate