[C++-sig] very basic: calling python function from c++
Roel Vanhout
roel at riks.nl
Wed Sep 10 15:54:30 CEST 2003
Hello everybody, I'm only just starting out with boost.python and with
python embedding and I have a very basic question. I have found examples
of how to get an object into c++ from python and call functions on it,
but what I'm trying to do is to get a function pointer to a python
function and call that function with two parameters. Basically I have
two numbers and users can enter an expression into the gui of the c++
program like this:
return num1 + num2
I thought that then in my c++ program, I'd prepend 'function
calculate(num1, num2):' to that string, indent the expresson properly
and then run the whole thing in python, passing the two numbers that I
have in my c++ program to the python function. So I'm looking for a way
to get a function pointer that I can pass two numbers and that returns a
double. I hope I made myself clear - can anyone help me? Thanks in advance.
cheers,
roel
More information about the Cplusplus-sig
mailing list