changeset 1 | 2fb8b9db1c86 |
0:ffa851df0825 | 1:2fb8b9db1c86 |
---|---|
1 #include "Python.h" |
|
2 |
|
3 static PyObject * |
|
4 ex_foo(PyObject *self, PyObject *args) |
|
5 { |
|
6 printf("Hello, world\n"); |
|
7 Py_INCREF(Py_None); |
|
8 return Py_None; |
|
9 } |
|
10 |
|
11 static PyMethodDef example_methods[] = { |
|
12 {"foo", ex_foo, METH_VARARGS, "foo() doc string"}, |
|
13 {NULL, NULL} |
|
14 }; |
|
15 |
|
16 PyMODINIT_FUNC |
|
17 initexample(void) |
|
18 { |
|
19 Py_InitModule("example", example_methods); |
|
20 } |