[Top][All Lists]

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

pb with oct file, return a matrix

From: Alain Baeckeroot
Subject: pb with oct file, return a matrix
Date: Wed, 22 Apr 2009 17:42:58 +0200
User-agent: KMail/1.9.9


I wrote a DEFUN_DLD and have trouble to return a matrix, it segfault
at return retval or in main program M=boucle_cc(...)!
I tried to run in gdb (and mkoctfile -g) but it does not help me.

I think i have exactly copied a working DEFUN_DLD i have which 
returns a matrix, but ...

Any help/hint/url is welcome :-)

Here is the code (with printf for debugging)
DEFUN_DLD( boucle_cc, args, nargout, "usage : rMat = boucle_cc(..)\n") {
        int NDATA=10000;
        Matrix rMat(NDATA, 22); // results
        octave_value_list retval;   // list of return values

        ...compute and put everything in rMat...

                printf(" ici boucle_cc 7, avant retval(0)= rMat\n");
                printf(" rMat(0,0) = %lf, (9999,21) = %lf;\n", rMat(0,0), 
rMat(9999,21) );
        retval(0) = rMat;
                printf(" ici boucle_cc 8, avant return retval\n");
        return retval;
$ gdb /usr/usr/bin/octave
(gdb) r
octave 1> main
 ici boucle_cc 7, avant 'retval(0)= rMat;'
 rMat(0,0) = -0.018000, (9999,21) = 10.715615;
 ici boucle_cc 8, avant return retval
*** glibc detected *** /usr/bin/octave: free(): invalid next size (fast): 
0x0b02f080 ***

Program received signal SIGSEGV, Segmentation fault.
---Type <return> to continue, or q <return> to quit---
[Switching to Thread 0xb59156c0 (LWP 27412)]
0xb7f3da90 in ?? () from /lib/

   (gdb) c
panic: Segmentation fault -- stopping myself...
address@hidden@��ظ��?��.5��? :w�P�?���-�??ܣq���?
F��xo�?qr\���?<ܣq���?{ ���?sɬ��
address@hidden to save variables to `octave-core'...��?�X��:▒�?:w�P�?�

Program received signal SIGSEGV, Segmentation fault.
0xb79774d0 in symbol_table::size () from /usr/lib/octave-3.0.1/
(gdb)  quit

reply via email to

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