help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading files from within c++ (feval)


From: Paul Kienzle
Subject: Re: Loading files from within c++ (feval)
Date: Thu, 14 Feb 2002 14:15:37 -0500

Not having looked at the relevant code, I'm guessing that load is
attempting to create a variable in the current symbol table but
failing because you haven't initialized the current symbol table.
Maybe something like:
        octave_value a;
        curr_sym_tab = new symbol_table(10);
        ... your feval stuff ...
        symbol_record *sr = curr_sym_tab->lookup("a");
        if (sr && sr->is_defined ()) a = sr->def ();
             
Paul Kienzle
address@hidden
 
On Thu, Feb 14, 2002 at 02:28:04PM +0100, Douglas Eck wrote:
> I'm reluctant to file a bug report but I can't get feval to
> work in 2.1.35 in a stand-alone C++ application. What I want
> to do is load a .mat file. That .mat file contains
> matrices and structs.  Is this even possible?
> I've tried many permutaitons of this feval call
> using the mailing list archives as a guide. None seem
> to work. Here's one failed attempt. :
> 
> #include <octave/oct.h>
> #include <octave/ov-struct.h>
> #include <octave/parse.h>
> #include <octave/oct-map.h>
> #include <math.h>
> int main(int argc, char * argv[]) {
>    octave_value_list args;
>    args(0) = "tst.mat";
>    args(1) = "a";
>    feval("load", args, 0); // no arguments returned
>    cout << "done" << endl;
> 
> I took that from Paul K's posting of a while back. I compiled it using;
> 
> g++ -pg -g tstFile.o  -o tstFile -L/usr/lib/octave-2.1.35 
> -L/usr/src/octave-2.1.35/kpathsea \
>     -lblas -loctave -loctinterp -ldl  -lcruft  -lg2c -ltermcap -lhdf5 
> -lreadline -lkpathsea -lfftw
> 
> And I get a segfault. This happens when I run on our alpha or on my pentium 
> box.
> Both run Dirk's debian packages.
> 
> Here's the segfault message from GNU gdb 5.1
> (gdb) run
> Starting program: /home/doug/src/tstFile/tstFile
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x200009aee38 in symbol_table::hash () from 
> /usr/lib/octave-2.1.35/liboctinterp.so.2.1.35
> 
> Cheers,
> Doug
> 
> 
> 
> -------------------------------------------------------------
> 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
> -------------------------------------------------------------
> 



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]