I would appreciate some help from the more experienced octave/octave-forg=
e=20
developers determining where to look for a problem that is plaguing my=20
attempts to port a package from Matlab to Octave.
I have a package of functions developed by someone else a few years ago,=20
probably Matlab 5.X time frame, consisting of about two dozen m files, pl=
us=20
half a dozen C files each implementing a separate function.
The symptom of the problem is a segmentation fault at some point after th=
e C=20
function returns.
The C file I am concentrating on right now declares a static mxArray=20
*outputMatrix =3D0 and *stateMatrix=3D0 at the beginning of the file, the=
n=20
later assigns outputMatrix=3DmxCreateDoubleMatrix (similarly for=20
stateMatrix).
The end of the function assigns plhs[0] =3D outputMatrix and=20
plhs[1]=3DstateMatrix.
I put printf statements in the C file to make sure it made it all the way=
=20
past the assignment, and it does, so it is somewhere after the function=20
assigns the matrix of output data to plhs and ends that the segmentation=20
fault is triggered. I am fairly new to octave, so I don't know yet how t=
o=20
debug into octave itself. Is there a way I can recompile octave with=20
debugging enabled and use gdb to set break points at the entry and exit=20
from my C file to see if a pointer is hosed somewhere?
This is on a Red Hat 8.0 machine, so gcc 3.2, octave built from=20
octave-2.1.36-9.src.rpm, octave-forge built from=20
octave-forge-2002.11.30.tar.gz.
Any known compatibility problems with those version? I didn't see anythi=
ng=20
in the mailing list archives that looks like it would apply to this=20
problem.
I have considered porting the C files completely to octave, but that isn'=
t=20
my top choice yet, because I don't have any mex programming background, s=
o=20
I'm afraid I would have to learn mex and oct programming interfaces at th=
e=20
same time, and really all I want to do is get this function useable as=20
quickly as possible.
Any help appreciated.
thanks,
--=20
Chris Caudle
|