Advertisement
danielhilst

Untitled

Jun 13th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <Python.h>
  2.  
  3. static PyObject *hello(PyObject *self, PyObject *args)
  4. {
  5. const char *str;
  6. if (!PyArg_ParseTuple(args, "s", &str))
  7. return NULL;
  8. printf("Hello %s\n", str);
  9. Py_INCREF(Py_None);
  10. return Py_None;
  11. }
  12.  
  13. static PyMethodDef HelloMethods[] = {
  14. {"hello", hello, METH_VARARGS, "Hello world example" },
  15. { NULL }
  16. };
  17.  
  18. PyMODINIT_FUNC inithello(void)
  19. {
  20. (void) Py_InitModule("hello", HelloMethods);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement