help-octave
[Top][All Lists]
Advanced

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

Problem with mex file


From: John W. Eaton
Subject: Problem with mex file
Date: Fri, 8 Sep 2006 22:01:29 -0400

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[3]). 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[0] and prhs[1].  Anything beyond that is going to be garbage
anyway.  Maybe it is just dumb luck that it works in Matlab?

jwe


reply via email to

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