From help-octave-request at bevo dot che dot wisc dot edu Thu Feb 14 13:18:19 2002 Subject: Re: Loading files from within c++ (feval) From: Paul Kienzle To: Douglas Eck , help-octave@bevo.che.wisc.edu 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 pkienzle at users dot sf dot net 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 > #include > #include > #include > #include > 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 -------------------------------------------------------------