Let’s say I have this Python function:
def foo(bar):
bar()
And this C function
void bar() {
}
How can I create a PyObject with Python C API that holds a pointer to bar function so I can call the Python function. Something like this
PyObject* function = PyObject_GetAttrString(module, "foo");
// how to create PyObject* args?
PyObject* result = PyObject_Call(function, args, NULL);
Searched and read the docs, but can not find a similar example