Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Python.h>
- static PyObject *hello(PyObject *self, PyObject *args)
- {
- const char *str;
- if (!PyArg_ParseTuple(args, "s", &str))
- return NULL;
- printf("Hello %s\n", str);
- Py_INCREF(Py_None);
- return Py_None;
- }
- static PyMethodDef HelloMethods[] = {
- {"hello", hello, METH_VARARGS, "Hello world example" },
- { NULL }
- };
- PyMODINIT_FUNC inithello(void)
- {
- (void) Py_InitModule("hello", HelloMethods);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement