Multfile C Extensions
Pete Shinners
pshinners at mediaone.net
Sun May 28 15:54:12 EDT 2000
i've got a C python extension that has gotten pretty large.
i'd like to break the file up into smaller components, but
i'm finding this is actually pretty tricky.
since all functions/variables must be static (aside from init)
how can i get the different files to work with each other?
i can work around most of the problems, but the biggest
one seems to be the initializing stuff.
is there an example of a C extension out there that is split
into a couple source files? the biggest problem is i want it
all in one module...
urgh, this shouldn't be so tough?
quick pseudo-example, how can i get this working?
Thanks!
---mymodule_a.cpp-----------------------------
static PyObject* myfunc_a(PyObject* self,PyObject* args);
static PyObject* myfunc_b(PyObject* self,PyObject* args);
static PyMethodDef __builtins__[] =
{
{ "func_a", myfunc_a, 1, "Func A"},
{ "func_b", myfunc_b, 1, "Func B"},
{ NULL, NULL }
};
void initmymodule()
{
Py_InitModule3("mymodule", __builtins__, "Doesn't Compile")
}
static PyObject* myfunc_a(PyObject* self,PyObject* args)
{
...
}
----------------------------------------------
--mymodule_b.cpp------------------------------
static PyObject* myfunc_a(PyObject* self,PyObject* args)
{
...
}
----------------------------------------------
More information about the Python-list
mailing list