help-octave
[Top][All Lists]
Advanced

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

Re: Calling Octave from C++


From: andrea.delbravo
Subject: Re: Calling Octave from C++
Date: Fri, 23 Mar 2018 03:28:17 -0700 (MST)

Well, sorry for the nmissing infos.
I wirk with Fedora 26 Ocatve 4.2.1. I tried also with Fedora 27 Octave 4.2.2
but the problem persist.
The application run perfectly under fedora 25 Octave 4.0.3.
I minimize the application in order to focalize the problem:
After several initialization the core of the problem is:

// THIS CODE IS WORKING
int qq =10;
int rr =15;
in(0) = octave_value(qq);
in(1) = octave_value(rr);
octave_value_list out = feval ("gcd", in, 1);
std::cout << out(0).int_value ()
and it prints the correct result = 5 the Greatest common disisor between 10
and 15

but if I run
// THIS CODE IN NOT WORKING
octave_value_list out = feval ("pp", in, 1);
where pp.m is a stupid Octave script which shuld disply the two numbers
(tested and working in the Octave environment)

Application crashes with Segmentation Fault insiede the interpreter, and I
cannot debug it inside because the interpreter is not compiled with debug
information

The OCTAVE_PATH environment variable define the path where the .m files are
saved (see Octave manual for example version 4.4. March 2018 pag 17, but
valid since a long time in all the Octave Version. I've been using it for at
least 7 years

The OCTAVE_PATH variable is correctly seen inside the C++ cose. Ifact if I
run the program with:

// THIS CODE IS WORKING
in(0) = octave_value(a); // where a is a char[] = OCTAVE_PATH
octave_value_list out = feval ("getenv", in, 1);   //getenv return the
Evironmental Variable (see Octave manual)
std::cout << out(0).string_value ()   // print the correct OCTAVE_PATH value

It seems that is I use an embedded function i worke, but if I use  my own
script it crashes

Thanks a lot in advance








--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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