[pypy-commit] cffi win32: add __stdcall test
mattip
noreply at buildbot.pypy.org
Wed Aug 22 21:22:57 CEST 2012
Author: mattip <matti.picus at gmail.com>
Branch: win32
Changeset: r873:f3e4f01be0b4
Date: 2012-08-22 22:20 +0300
http://bitbucket.org/cffi/cffi/changeset/f3e4f01be0b4/
Log: add __stdcall test
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -4202,6 +4202,17 @@
return ptr->a1 + ptr->a2;
}
+#ifdef MS_WIN32
+#define stdcall __stdcall
+#else
+#define sdcall
+#endif
+
+static int stdcall _testfunc21(int a, int b)
+{
+ return a+b;
+}
+
static PyObject *b__testfunc(PyObject *self, PyObject *args)
{
/* for testing only */
@@ -4231,6 +4242,7 @@
case 18: f = &_testfunc18; break;
case 19: f = &_testfunc19; break;
case 20: f = &_testfunc20; break;
+ case 21: f = &_testfunc21; break;
default:
PyErr_SetNone(PyExc_ValueError);
return NULL;
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -905,6 +905,13 @@
BSShort = new_primitive_type("short")
assert f(3, cast(BSChar, -3), cast(BUChar, 200), cast(BSShort, -5)) == 192
+def test_call_function_21():
+ BInt = new_primitive_type("int")
+ BFunc21 = new_function_type((BInt, BInt), BInt, False)
+ f = cast(BFunc21, _testfunc(21))
+ assert f(40, 2) == 42
+ assert f(-100, -100) == -200
+
def test_cannot_call_with_a_autocompleted_struct():
BSChar = new_primitive_type("signed char")
BDouble = new_primitive_type("double")
More information about the pypy-commit
mailing list