// COMPILE: mkoctfile --link-stand-alone standalone.cc -o standalone // ENVIRONMENT: export LD_LIBRARY_PATH=/usr/local/lib/octave/5.1.0:$LD_LIBRARY_PATH // RUN: ./standalone #include #include #include #include #include int main (void) { octave::interpreter interpreter; try { int status = interpreter.execute (); if (status != 0) { std::cerr << "creating embedded Octave interpreter failed!" << std::endl; return status; } octave::feval ("which", ovl ("pkg"), 0); octave::feval ("pkg", ovl ("load", "control"), 0); octave_value_list out = octave::feval ("tf", ovl ('s'), 1); if (out.length () > 0) octave::feval ("display", out, 0); else std::cout << "invalid" << std::endl; } catch (const octave::exit_exception& ex) { std::cerr << "Octave interpreter exited with status = " << ex.exit_status () << std::endl; } catch (const octave::execution_exception&) { std::cerr << "error encountered in Octave evaluator!" << std::endl; } return 0; }