Vinay Sajip added the comment:

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.

----------
nosy: +vinay.sajip

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17310>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to