Path: blob/main/python/python-wasm/src/extension/hellozigmodule.c
1067 views
#include <Python.h>1#include <unistd.h>23extern PyObject *hello(PyObject *self, PyObject *args);4extern PyObject *add389(PyObject *self, PyObject *args);5extern PyObject *gcd_impl(PyObject *self, PyObject *args);67static PyMethodDef module_methods[] = {8{"hello", _PyCFunction_CAST(hello), METH_VARARGS, "Say hello to you."},9{"add389", _PyCFunction_CAST(add389), METH_VARARGS, "Add 389 to a C long."},10{"gcd", _PyCFunction_CAST(gcd_impl), METH_VARARGS, "GCD of two C longs"},11{NULL, NULL, 0, NULL}};1213static int module_clear(PyObject *module) { return 0; }1415static void module_free(void *module) { module_clear((PyObject *)module); }1617struct PyModuleDef _hellomodule = {18.m_name = "hellozig",19.m_methods = module_methods,20.m_clear = module_clear,21.m_free = module_free,22};2324PyMODINIT_FUNC PyInit_hellozig(void) { return PyModuleDef_Init(&_hellomodule); }2526