summaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-07-21 20:25:56 +0200
committerArmin Rigo <arigo@tunes.org>2020-07-21 20:25:56 +0200
commit764eadc587f8ab2d67389bb1c1f850921b9f1bae (patch)
tree94586ff582574ccba8cc08871a8aff911bc0ec64 /c
parent8cc7ea55cdac358b4520d12e86c5882ba4c00824 (diff)
downloadcffi-764eadc587f8ab2d67389bb1c1f850921b9f1bae.tar.gz
more of the same, for win64
Diffstat (limited to 'c')
-rw-r--r--c/libffi_msvc/ffi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/c/libffi_msvc/ffi.c b/c/libffi_msvc/ffi.c
index 8a56c87..b9e324f 100644
--- a/c/libffi_msvc/ffi.c
+++ b/c/libffi_msvc/ffi.c
@@ -451,6 +451,11 @@ ffi_prep_closure_loc (ffi_closure* closure,
|| cif->arg_types[3]->type == FFI_TYPE_DOUBLE))
mask |= 8;
+ /* if we return a non-small struct, then the first argument is a pointer
+ * to the return area, and all real arguments are shifted by one */
+ if (cif->flags == FFI_TYPE_STRUCT)
+ mask = (mask & ~8) << 1;
+
/* 41 BB ---- mov r11d,mask */
BYTES("\x41\xBB"); INT(mask);