Guido van Rossum | 026f01a | 1996-09-06 21:16:21 +0000 | [diff] [blame^] | 1 | #include "Python.h" |
2 | |||||
3 | static PyObject * | ||||
4 | ex_foo(self, args) | ||||
5 | PyObject *self, *args; | ||||
6 | { | ||||
7 | printf("Hello, world\n"); | ||||
8 | Py_INCREF(Py_None); | ||||
9 | return Py_None; | ||||
10 | } | ||||
11 | |||||
12 | static PyMethodDef example_methods[] = { | ||||
13 | {"foo", ex_foo, 1, "foo() doc string"}, | ||||
14 | {NULL, NULL} | ||||
15 | }; | ||||
16 | |||||
17 | void | ||||
18 | initexample() | ||||
19 | { | ||||
20 | Py_InitModule("example", example_methods); | ||||
21 | } |