[ACCEPTED]-How to embed the GNU Octave in C/C++ program?-octave

Accepted answer
Score: 21

Something like this

embed.cpp

#include <iostream>
#include <octave/octave.h>

int main(int argc,char* argv)
{
  int embedded;
  octave_main(argc,argv,embedded=0);  
  return embedded;
}

Then

mkoctfile embed.cpp --link-stand-alone -o embed in order to make 8 a standalone executable.

To call octave functions 7 whether they are provided by scripts or 6 octaveforge modules you can then use feval 5 which takes the octave function name as 4 string, an octave_value_list of the input 3 variables to that function, and the number 2 of variables to that function as integer.

See 1 here for further information.

More Related questions