/PC/example_nt/example.c

http://unladen-swallow.googlecode.com/ · C · 20 lines · 17 code · 3 blank · 0 comment · 0 complexity · 6fb5f3baeff6680256fe7dd371264a21 MD5 · raw file

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