summaryrefslogtreecommitdiff
path: root/cffi
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2016-02-04 07:40:38 +0100
committerArmin Rigo <arigo@tunes.org>2016-02-04 07:40:38 +0100
commite4db24a1b11a232b833c0f49c1f9634734318280 (patch)
tree1b861a2b981e9e42ce77b61cc3d521a132880c35 /cffi
parentc62ba7852146c9fe595c91eaf305161bf6ccf6e1 (diff)
downloadcffi-e4db24a1b11a232b833c0f49c1f9634734318280.tar.gz
Issue #245: __stdcall not generated correctly on extern "Python" functions
Diffstat (limited to 'cffi')
-rw-r--r--cffi/_cffi_include.h6
-rw-r--r--cffi/recompiler.py2
2 files changed, 8 insertions, 0 deletions
diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h
index 6e90dd8..f412fc0 100644
--- a/cffi/_cffi_include.h
+++ b/cffi/_cffi_include.h
@@ -231,6 +231,12 @@ static void (*_cffi_call_python_org)(struct _cffi_externpy_s *, char *);
((got_nonpos) == (expected <= 0) && \
(got) == (unsigned long long)expected)
+#ifdef MS_WIN32
+# define _cffi_stdcall __stdcall
+#else
+# define _cffi_stdcall /* nothing */
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
index 914d9e7..2bb516d 100644
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -1170,6 +1170,8 @@ class Recompiler:
repr_arguments = ', '.join(arguments)
repr_arguments = repr_arguments or 'void'
name_and_arguments = '%s(%s)' % (name, repr_arguments)
+ if tp.abi == "__stdcall":
+ name_and_arguments = '_cffi_stdcall ' + name_and_arguments
#
def may_need_128_bits(tp):
return (isinstance(tp, model.PrimitiveType) and