Hi all,
I am probably missing something basic here, but why does this not work?
[bash] > cat > test.cc
#include "oct.h"
DEFUN_DLD (test, args, ,"")
{
double* y = args(0).vector_value().fortran_vec();
octave_stdout << ">> " << y[0] << "," << y[1] << "\n";
}
EOF
[bash] > mkoctfile -v test.cc
g++ -c -fPIC -I/usr/local/include/octave-2.1.71
-I/usr/local/include/octave-2.1.71/octave -I/usr/local/include
-mieee-fp -g -O2 test.cc -o test.o
g++ -shared -Wl,-Bsymbolic -o test.oct test.o
-L/usr/local/lib/octave-2.1.71 -loctinterp -loctave -lcruft -lcblas
-lf77blas -latlas -lfftw3 -lreadline -lncurses -ldl -lm
-L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2
-L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../.. -lfrtbegin -lg2c
-lm -lgcc_s
[bash] > octave
GNU Octave, version 2.1.71 (i686-pc-linux-gnu).
Copyright (C) 2005 John W. Eaton.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.
Additional information about Octave is available at
http://www.octave.org.
Please contribute if you find this software useful.
For more information, visit http://www.octave.org/help-wanted.html
Report bugs to <address@hidden> (but first, please read
http://www.octave.org/bugs.html to learn how to write a helpful
report).
octave:1> a=[1,2,3];
octave:2> test(a)
panic: Segmentation fault -- stopping myself...
>> 1,2
attempting to save variables to `octave-core'...
save to `octave-core' complete
Segmentation fault
-------------------------------------------------------------
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
-------------------------------------------------------------