[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using octave from a C++ program
From: |
taltman |
Subject: |
Re: using octave from a C++ program |
Date: |
Fri, 24 Oct 2003 10:29:15 -0700 (PDT) |
It is possible to get just about the same effect of compiling an
Octave m-file and accessing it from the command line.
My initial approach would be to do the following:
* code up your program in Octave m-files. Debug it and make it
error-tolerant.
* compile it into a oct-file using 'mkoctfile', following the examples
that Paul was describing.
* write a really tiny one-line Octave script, with the following as
the first line:
#!/usr/bin/octave -qf
Assuming that '/usr/bin/octave' is the path to Octave on your system,
this will launch the octave interpreter automagically as a script (
just like with Perl or shell scripts ). '-q' turns off the initial
text intro to the Octave interpreter, taking you straight to the
prompt. '-f' bypasses any ".octaverc" file that you might have in your
home directory. Also, make sure to tweak the permissions of this small
wrapper-script so that it is executable. This means that the only
thing that the Octave interpreter would have to do is to initialize,
and then call your one-line program, all of which you compiled into a
C++ extension of Octave.
Any other tips out there?
~Tomer Altman
On Oct 23, 2003 at 9:57pm, address@hidden wrote:
pkienz >Date: Thu, 23 Oct 2003 21:57:12 +0100
pkienz >From: address@hidden
pkienz >To: Jonathan Hudson <address@hidden>,
pkienz > address@hidden
pkienz >Subject: Re: using octave from a C++ program
pkienz >Resent-Date: Thu, 23 Oct 2003 20:53:52 -0500
pkienz >Resent-From: address@hidden
pkienz >
pkienz >On 22 Oct 2003 at 10:33, Jonathan Hudson wrote:
pkienz >
pkienz >> I'm trying to use some of octave's functions within a C++ program,
pkienz >> but I'm getting lots of undefined references and
pkienz >> I'm not sure what I'm doing wrong.
pkienz >
pkienz >You are failing to initialize the interpreter. Right now, you have
pkienz >to borrow a lot of code from octave's main procedure to do this.
pkienz >Eventually we will sort it so that you can call init and eval and
pkienz >it will do the right thing. We haven't yet because in almost all
pkienz >instances, it makes more sense to extend octave with C code
pkienz >than extend C code with octave.
pkienz >
pkienz >The code in src/DLD-FUNCTIONS gives several examples of
pkienz >how to extend octave. There is also a simple example in
pkienz >another directory. The best overview document is da coda al
pkienz >fine at http://octave.sf.net/coda, but it is somewhat out of
pkienz >date by now. I also remember putting stuff on
pkienz >wiki.octave.org, but I can't find it there now.
pkienz >
pkienz >Hope that helps,
pkienz >
pkienz >Paul Kienzle
pkienz >address@hidden
pkienz >
pkienz >
pkienz >
pkienz >-------------------------------------------------------------
pkienz >Octave is freely available under the terms of the GNU GPL.
pkienz >
pkienz >Octave's home on the web: http://www.octave.org
pkienz >How to fund new projects: http://www.octave.org/funding.html
pkienz >Subscription information: http://www.octave.org/archive.html
pkienz >-------------------------------------------------------------
pkienz >
pkienz >
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------