~ubuntu-branches/debian/sid/octave3.0/sid

« back to all changes in this revision

Viewing changes to doc/interpreter/dynamic.texi

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2009-04-28 15:17:35 UTC
  • mfrom: (6.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090428151735-gm59wmfcmwec3f9e
Tags: 1:3.0.5-3
debian/in/PACKAGE.postinst: Add -verbose option when calling 'pkg
rebuild' in octave and redirect stdin from /dev/null.  This is just to
help debugging the hang up on the mipsel buildd when installing
octave3.0 for building other packages (Bug#524745).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1733
1733
following C++ program, uses class Matrix from liboctave.a or
1734
1734
liboctave.so.
1735
1735
 
1736
 
@example
1737
 
@group
1738
 
#include <iostream>
1739
 
#include <octave/oct.h>
1740
 
int
1741
 
main (void)
1742
 
@{
1743
 
  std::cout << "Hello Octave world!\n";
1744
 
  int n = 2;
1745
 
  Matrix a_matrix = Matrix (n, n);
1746
 
  for (octave_idx_type i = 0; i < n; i++)
1747
 
    @{
1748
 
      for (octave_idx_type j = 0; j < n; j++)
1749
 
        @{
1750
 
          a_matrix (i, j) = (i + 1) * 10 + (j + 1);
1751
 
        @}
1752
 
    @}
1753
 
  std::cout << a_matrix;
1754
 
  return 0;
1755
 
@}
1756
 
@end group
1757
 
@end example
 
1736
@examplefile{standalone.cc}
1758
1737
 
1759
1738
@noindent
1760
1739
mkoctfile can then be used to build a standalone application with a
1762
1741
 
1763
1742
@example
1764
1743
@group
1765
 
$ mkoctfile --link-stand-alone hello.cc -o hello
1766
 
$ ./hello
 
1744
$ mkoctfile --link-stand-alone standalone.cc -o standalone
 
1745
$ ./standalone
1767
1746
Hello Octave world!
1768
1747
  11 12
1769
1748
  21 22
1772
1751
@end example
1773
1752
 
1774
1753
Note that the application @code{hello} will be dynamically linked
1775
 
against the octave libraries and any octave support libraries.
 
1754
against the octave libraries and any octave support libraries. The above
 
1755
allows the Octave math libraries to be used by an application. It does
 
1756
not however allow the script files, oct-files or builtin functions of
 
1757
Octave to be used by the application. To do that the Octave interpreter
 
1758
needs to be initialized first. An example of how to do this can then be
 
1759
seen in the code
 
1760
 
 
1761
@examplefile{embedded.cc}
 
1762
 
 
1763
@noindent
 
1764
which is compiled and run as before as a standalone application with
 
1765
 
 
1766
@example
 
1767
@group
 
1768
$ mkoctfile --link-stand-alone embedded.cc -o embedded
 
1769
$ ./embedded
 
1770
GCD of [10, 15] is 5
 
1771
$
 
1772
@end group
 
1773
@end example
 
1774