summaryrefslogtreecommitdiff
path: root/PC/example_nt/example.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-09-06 21:16:21 +0000
committerGuido van Rossum <guido@python.org>1996-09-06 21:16:21 +0000
commit08dc1ef3b714e0b31bbb99bbd870d89eaf381f18 (patch)
treee6bd96b2051217ef648d7b383e7f9a6d67325be3 /PC/example_nt/example.c
parent77edb66672923bfc0d5e49f507a099246a94b9bf (diff)
downloadcpython-08dc1ef3b714e0b31bbb99bbd870d89eaf381f18.tar.gz
A directory with a working example of how to build an extension.
Diffstat (limited to 'PC/example_nt/example.c')
-rw-r--r--PC/example_nt/example.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/PC/example_nt/example.c b/PC/example_nt/example.c
new file mode 100644
index 0000000000..dd8964bbb0
--- /dev/null
+++ b/PC/example_nt/example.c
@@ -0,0 +1,21 @@
+#include "Python.h"
+
+static PyObject *
+ex_foo(self, args)
+ PyObject *self, *args;
+{
+ printf("Hello, world\n");
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyMethodDef example_methods[] = {
+ {"foo", ex_foo, 1, "foo() doc string"},
+ {NULL, NULL}
+};
+
+void
+initexample()
+{
+ Py_InitModule("example", example_methods);
+}