Embedded Python and C Callback functions

doc.mefisto at gmail.com doc.mefisto at gmail.com
Sat Jun 6 14:09:37 EDT 2015


Hi. I'm a newbie in python. But I want embed it in my C program.

There is such method of my class:
@staticmethod
def install_instr_callback(callback):
    # set hook for every change of PC
    m68k.set_instr_hook_callback(callback)

And in my C code there is such callback function:
static PyObject *my_instr_callback(PyObject *self);

I want call install_instr_callback from C with specifying of my callback. I do:
PyObject_CallMethod(myClass, "install_instr_callback", "(O)", my_instr_callback);
But python writes me: [b]null argument to internal routine[/b].

How can I fix this problem?



More information about the Python-list mailing list