Skip to content

Instantly share code, notes, and snippets.

@danieldaeschle
Created October 24, 2018 13:40
Show Gist options
  • Save danieldaeschle/df38bd413bcd7db5b1e9751a0c2af11c to your computer and use it in GitHub Desktop.
Save danieldaeschle/df38bd413bcd7db5b1e9751a0c2af11c to your computer and use it in GitHub Desktop.
#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