[pypy-svn] r22630 - pypy/dist/pypy/rpython/rctypes/test

gromit at codespeak.net gromit at codespeak.net
Wed Jan 25 10:46:48 CET 2006


Author: gromit
Date: Wed Jan 25 10:46:47 2006
New Revision: 22630

Added:
   pypy/dist/pypy/rpython/rctypes/test/_rctypes_test.c
Log:
ADD: Forgot the actual C-level test

Added: pypy/dist/pypy/rpython/rctypes/test/_rctypes_test.c
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/rctypes/test/_rctypes_test.c	Wed Jan 25 10:46:47 2006
@@ -0,0 +1,36 @@
+/* simple test, currently only for structures */
+#include <Python.h>
+#ifdef MS_WIN32
+#include <windows.h>
+#endif
+#if defined(MS_WIN32) || defined(__CYGWIN__)
+#define EXPORT(x) __declspec(dllexport) x
+#else
+#define EXPORT(x) x
+#endif
+
+PyMethodDef module_methods[] = {
+	{ NULL, NULL, 0, NULL},
+};
+
+
+typedef struct tagpoint {
+	int x;
+	int y;
+} point;
+
+EXPORT(int) _testfunc_byval(point in, point *pout)
+{
+	if (pout) {
+		pout->x = in.x;
+		pout->y = in.y;
+	}
+	return in.x + in.y;
+}
+
+DL_EXPORT(void)
+init_rctypes_test(void)
+{
+	Py_InitModule("_rctypes_test", module_methods);
+}
+



More information about the Pypy-commit mailing list