So I\'m almost done. Now I have working code which calls python callback function.
Only thing I need now is how to pass argument to the python callback function.
The arguments to the callback are the second argument to PyEval_CallObject()
. Right now you're building an empty tuple, which means "no arguments". So, change that. Where you now do:
arglist = Py_BuildValue("()"); /* No arguments needed */
you instead pass Py_BuildValue
whatever arguments you want the Python function to receive. For example, if you want to pass the callback an integer, a string and a Python object you got from somewhere, you would do:
arglist = Py_BuildValue("(isO)", the_int, the_str, the_pyobject);