[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: oct files
From: |
Paul Kienzle |
Subject: |
Re: oct files |
Date: |
Mon, 31 Mar 2003 20:47:50 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021212 |
branganj wrote:
Hi,
I have tried to dynamically link a function, but I get the following warnings:
With mkoctfile mpi_mm.cc I get:
mpi_mm.cc: In function `class octave_value_list Fmpi_mm(const class
octave_value_list &, int)':
mpi_mm.cc:35: warning: unused variable `int nbytes'
mpi_mm.cc:133: warning: control reaches end of non-void function
`Fmpi_mm(const octave_value_list &, int)'
You are not returning an octave_value_list() from your function. The
usual style is:
octave_value_list retval;
if (some error) {
error("message");
} else {
retval(0) = returned_value;
}
return retval;
There is an oct file created, but in octave when I call the function it gives
:
error: Segmentation fault -- stopping myself...
attempting to save variables to `octave-core'...
save to `octave-core' complete
Segmentation fault (core dumped)
I have defined the function with DEFUN_DLD (mpi_mm, , ,"Parallel
multiplication of two matrices using mpi")
And execution is throug mpi_mm(0,0)
So I shouldn't be passing in any octave_value_lists??Or is it ok to leave it
blank??
Do I need to have a return value? Can this be an octave_matrix ? At the moment
I have it only printing out stuff, but I have tried with another type
returning an octave_matrix, but this doesn't get a .oct file created.
See above. The return value can be any octave_value_list. It's not
surprising it doesn't work with no return value. To return a matrix,
do the following:
Matrix r(n,m);
...
retval(0) = r;
return retval;
Da Coda Al Fine [http://octave.sf.net/coda/coda.html] talks
about this sort of thing.
Paul Kienzle
address@hidden
-------------------------------------------------------------
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
-------------------------------------------------------------