[ < ] | [ > ] | [ << ] | [ 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 liboctave.so.
mkoctfile can then be used to build a standalone application with a command like
$ mkoctfile --link-stand-alone standalone.cc -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 embedded.cc -o embedded $ ./embedded GCD of [10, 15] is 5 $ |