[issue20160] broken ctypes calling convention on MSVC / 64-bit Windows (large structs)

Bob report at bugs.python.org
Tue Mar 24 13:02:31 CET 2015


Bob added the comment:

I was looking into http://lists.cs.uiuc.edu/pipermail/llvmbugs/2012-September/025152.html 'Use of libclang python bindings on Windows 7 64 bit fails with memory access violation'

It appears to be 90% fixed with this patch, but I believe there is still a problem when structs are passed back though a callback function.

Could this be the correct addition to fix it?
in ffi_prep_incoming_args_SYSV() _ctypes\libffi_msvc\ffi.c(line 377)

      /* because we're little endian, this is what it turns into.   */

+#if _WIN64
+      if ((*p_arg)->type == FFI_TYPE_STRUCT && z > 8)
+          {
+          z = 8;
+          *p_argv = *(void**)argp;
+          }
+      else
+          {
+          *p_argv = (void*)argp;
+          }
+#else
      *p_argv = (void*)argp;
+#endif

----------
nosy: +Bob

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20160>
_______________________________________


More information about the Python-bugs-list mailing list