I've been following some code examples on how to build a C module for Python, however it seems like Py_InitModule isn't defined anywhere.
Most sources say it's within the modsupport.h file, but the macro isn't defined there.
I'm using the includes given by the Win32 binaries download, and everything seems in check.
Any suggestions?
Works for me on 2.7.2, Python 2 or 3? For example, for a module called Example:
Python 2:
/* Module entry point Python 2 */
PyMODINIT_FUNC initExample(void)
{
(void) Py_InitModule("Example", ExampleMethods);
}
Python 3:
/* Module entry point Python 3 */
PyMODINIT_FUNC PyInit_Example(void)
{
return PyModule_Create(&Example_module);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With