diff options
author | Guido van Rossum <guido@python.org> | 1996-09-06 21:16:21 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-09-06 21:16:21 (GMT) |
commit | 026f01a29751e7bd91b0f62b54beb5b9eb24e73f (patch) | |
tree | 81ce08172da7c7ce4bf500602a04db9335661564 /PC/example_nt/example.c | |
parent | 5c1d1ee8a8a77cfb6f7226a5d0123244ddfd84a3 (diff) | |
download | cpython-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.c | 21 |
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); +} |