call octave functions direction from c++ (not using feval() )

View: New views
1 Messages — Rating Filter:   Alert me  

call octave functions direction from c++ (not using feval() )

by daviddoria :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I know how to call octave function from c++, for example, to integrate the function x^2 from 0 to 2 using "quad", I can do

#include <octave/octave.h>
#include <octave/oct.h>
#include <octave/parse.h>

int main(int argc, char **argv)
{
octave_main (argc, argv, 1)
f_arg(0) = "x^2";
f_arg(1) = 0;
f_arg(2) = 2;
f_arg(3) = octave_value(m);
f_ret = feval("quad", f_arg);
       
double ans = f_ret(0).double_value();
}

However, is there a way to call directly the function quad() that octave calls (ie skip the interpreted language step)? I am using fedora so I have the octave source - seems like this should be possible.

Anyone have any hints?

Thanks,
Dave