PyObject* ( *func )( PyObject*, PyObject* )
Which is bad, because we want to integrate Python directly into our program without having to specificially mark functions like THIS_IS_A_PYTHON_FUNCTION_LOL because that's silly.
So, what I've got in mind is an intermediate function which intercepts the call from Python, parses the tuple that the arguments come packed in, then calls the appropriate C-function.
The problem is the syntax. The only way I can figure out how to do it is to store the C-functions in a string-to-functor map. Which means, from python, you'd use something like -
module.call( "funcname", arg1, arg2, arg3, etc )
Which is, essentially, the same method I'm using to call Python functions from C++ -
python::call( "funcname", arg1, arg2, arg3, etc )
Now, ideally, you'd want to bind your functions directly to uniquely-named identifiers in Python (which can be done). The problem with this is the fact that the intermediate function needs to be called to resolve the arguments (from either direction, C->Python calls need to have their arguments packed into a tuple then passed to Python too).
Likewise, you also need to expose functionality between the two languages. This is done with the expose function -
module.expose( some_function, "func_name_to_bind_to" )
python::expose( some_functor, "func_name_to_bind_to" )
Again, its very symmetric, which is a good thing and a bad thing. Its good because its somewhat consistant. Its bad because it doesn't make full use of the power of Python; its essentially limited by the bounds of what C++ can do.
What I really need is a way to retrieve the name of the function being called from Python, so if, say -
Were called, I'd be able to retrieve the string somefunc. This would allow me to go beyond the call/expose pattern by actually adding functions into the module dictionary (which you can't really do in C++).
Anyway. I have to go implement all of this... after lunch. Mmmm I need lunch.