PyMODINIT_FUNC PyInit_accimage()

in accimagemodule.c [275:321]


PyMODINIT_FUNC PyInit_accimage(void) {
#endif
    PyObject* m;

    /*
     * Due to cross platform compiler issues the slots must be filled here.
     * It's required for portability to Windows without requiring C++.
     */
    Image_Type.tp_base = &PyBaseObject_Type;
    Image_Type.tp_init = (initproc) Image_init;
    Image_Type.tp_dealloc = (destructor) Image_dealloc;
    Image_Type.tp_new = PyType_GenericNew;

#if PY_MAJOR_VERSION == 2
    m = Py_InitModule("accimage", NULL);
#else
    static struct PyModuleDef module_def = {
       PyModuleDef_HEAD_INIT,
       "accimage",
       NULL,
       -1,
       NULL
    };
    m = PyModule_Create(&module_def);
#endif

    if (m == NULL)
        goto err;

    if (PyType_Ready(&Image_Type) < 0)
        goto err;

    PyModule_AddObject(m, "Image", (PyObject*) &Image_Type);

#if PY_MAJOR_VERSION == 2
    return;
#else
    return m;
#endif

err:
#if PY_MAJOR_VERSION == 2
    return;
#else
    return NULL;
#endif
}