The initialization function is called, when an extension module is imported.
New methods are registered with the Python interpreter.
Initialization method for our example module „factorial“:
Methods Tables:
static PyMethodDef factorialMethods[] = {
{ "fact", wrap_fact, 1 },
{ NULL, NULL }
};
Initialization Function:
void initfactorial() {
PyObject *m;
m = Py_InitModule("factorial",
factorialMethods);
}