Loading cextern/helloworld.c +23 −8 Original line number Diff line number Diff line // Simple C program to display "Hello World" // Header file for input output functions #include <stdio.h> #include <Python.h> // main function - // where the execution of program begins int main() static PyObject* _helloworld(PyObject* self, PyObject* args) { printf("Hello World\n"); return Py_None; } static PyMethodDef Methods[] = { { "helloworld", _helloworld, METH_NOARGS, "Prints Hello World" }, { NULL, NULL, 0, NULL } }; // prints hello world printf("Hello World"); // Our Module Definition struct static struct PyModuleDef Module = { PyModuleDef_HEAD_INIT, "helloworld", "prints Hello World", -1, Methods }; return 0; // Initializes our module using our above struct PyMODINIT_FUNC PyInit_helloworld(void) { return PyModule_Create(&Module); } Loading
cextern/helloworld.c +23 −8 Original line number Diff line number Diff line // Simple C program to display "Hello World" // Header file for input output functions #include <stdio.h> #include <Python.h> // main function - // where the execution of program begins int main() static PyObject* _helloworld(PyObject* self, PyObject* args) { printf("Hello World\n"); return Py_None; } static PyMethodDef Methods[] = { { "helloworld", _helloworld, METH_NOARGS, "Prints Hello World" }, { NULL, NULL, 0, NULL } }; // prints hello world printf("Hello World"); // Our Module Definition struct static struct PyModuleDef Module = { PyModuleDef_HEAD_INIT, "helloworld", "prints Hello World", -1, Methods }; return 0; // Initializes our module using our above struct PyMODINIT_FUNC PyInit_helloworld(void) { return PyModule_Create(&Module); }