Problem with mex file
John W. Eaton
jwe at bevo.che.wisc.edu
Fri Sep 8 21:01:29 CDT 2006
On 8-Sep-2006, frank wang wrote:
| I use the mkoctfile --mex to compile the c code and it works great. Thanks.
| However, when I run the code with fewer input, it will cause segment fault.
| It is caused by function mxGetPr. For example, if in the c code, I have
| px=mxGetPr(pRhs). But I only passed 2 parameters, this will cause segment
| fault. I fix this by changing my c code. But I just want to point it out
| since in Matlab it works.
Why should it work? If you pass two parameters, then the values are
in prhs and prhs. Anything beyond that is going to be garbage
anyway. Maybe it is just dumb luck that it works in Matlab?
More information about the Help-octave