manpagez: man pages & more
info octave
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.3 Standalone Programs

The libraries Octave itself uses, can be utilized in standalone applications. These applications then have access, for example, to the array and matrix classes as well as to all the Octave algorithms. The following C++ program, uses class Matrix from liboctave.a or

mkoctfile can then be used to build a standalone application with a command like

$ mkoctfile --link-stand-alone -o standalone
$ ./standalone
Hello Octave world!
  11 12
  21 22

Note that the application hello will be dynamically linked against the octave libraries and any octave support libraries. The above allows the Octave math libraries to be used by an application. It does not however allow the script files, oct-files or builtin functions of Octave to be used by the application. To do that the Octave interpreter needs to be initialized first. An example of how to do this can then be seen in the code

which is compiled and run as before as a standalone application with

$ mkoctfile --link-stand-alone -o embedded
$ ./embedded
GCD of [10, 15] is 5

© 2000-2017
Individual documents may contain additional copyright information.