CPython API: the module
static PyMethodDef pysimple_methods[] = {
{"square", square_wrapper, METH_VARARGS, "Square function"},
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef pysimple_module = {
PyModuleDef_HEAD_INIT, "pysimple", NULL, -1, pysimple_methods
};
PyMODINIT_FUNC PyInit_pysimple(void) {
return PyModule_Create(&pysimple_module);
}
The symbol name PyInit_<name> must match the module name.