summaryrefslogtreecommitdiffstats
path: root/PC/example_nt/example.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-09-06 21:16:21 (GMT)
committerGuido van Rossum <guido@python.org>1996-09-06 21:16:21 (GMT)
commit026f01a29751e7bd91b0f62b54beb5b9eb24e73f (patch)
tree81ce08172da7c7ce4bf500602a04db9335661564 /PC/example_nt/example.c
parent5c1d1ee8a8a77cfb6f7226a5d0123244ddfd84a3 (diff)
downloadcpython-026f01a29751e7bd91b0f62b54beb5b9eb24e73f.zip
cpython-026f01a29751e7bd91b0f62b54beb5b9eb24e73f.tar.gz
cpython-026f01a29751e7bd91b0f62b54beb5b9eb24e73f.tar.bz2
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 0000000..dd8964b
--- /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);
+}