0
hello I am developing a python module and I have the following problem. When the module is compiled, only one function is available (fun1). how do I get fun2 stay available too?
#define PY_SSIZE_T_CLEAN
#include <Python.h>
static PyObject* spam_fun2(PyObject *self)
{
# codigos
return Py_None;
}
static PyObject* spam_fun1(PyObject *self)
{
# codigos
return Py_None;
}
static struct PyModuleDef spammethods[] = {
{ "fun1", spam_fun1, METH_NOARGS, " " },
{ "fun2", spam_fun2, METH_NOARGS, " " },
{ NULL, NULL, 0, NULL }
};
static struct PyModuleDef spammodule = {
PyModuleDef_HEAD_INIT,
"spam",
"Lib exe command",
-1,
spammethods
};
PyMODINIT_FUNC PyInit_spam()
{
return PyModule_Create(&spammodule);
}
compiling:
from distutils.core import setup
from distutils.core import Extension
setup(
name='spam',
version='1.0',
ext_modules=[Extension('spam', ['spam.c'])]
)
How you compiled and tested the code?
– Woss
there I edited the question
– Edinho
Tips: avoid spelling mistakes, always make intuitive titles so that the question is easily found by people with similar problems.
– Guilherme Nascimento