extending w/o creating a new module??

Johan Hahn johahn at delta.telenordia.se
Sun May 19 04:48:48 EDT 2002


Hi

Is there a more dynamic way of binding functions in python to C than to
create a PyMethodDef and use it when creating a new module with
PyInit_InitModule ??.

I would like to add the function send(text) to an existing python module
(b4.py) and have that function call the C function:
static PyObject* sendc(PyObject* self, PyObject* args)
{
    /*...*/
}


My attempts so far are failing because I can't create a PyFunction object
that I can pass to PyObject_SetAttrString(b4, "send", ?) as the last
argument. There is no documentation for PyFuntion_New and as I understand it
takes a code object. And to create a code object that binds to a c-function
seemed like a dead end.

Am I missing something?

thanks...johahn







More information about the Python-list mailing list