Commits

mattip committed f3e4f01

add __stdcall test

Comments (0)

Files changed (2)

c/_cffi_backend.c

     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 */
     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;
     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")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.