Created
October 24, 2018 13:40
-
-
Save danieldaeschle/df38bd413bcd7db5b1e9751a0c2af11c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Python.h> | |
PyObject *hello(PyObject *self, PyObject *args) { | |
printf("Hello World\n"); | |
Py_RETURN_NONE; | |
} | |
struct PyMethodDef greeter_methods[] = { | |
{"hello", hello, METH_NOARGS, "Some docs..."}, | |
{NULL, NULL, 0, NULL} | |
}; | |
struct PyModuleDef greeter = { | |
PyModuleDef_HEAD_INIT, | |
"greeter", | |
"It's just docs", | |
-1, | |
greeter_methods | |
}; | |
PyMODINIT_FUNC PyInit_greeter(void) { | |
return PyModule_Create(&greeter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment