Info

This question is closed. Reopen it to edit or answer.

Why does using mexErrMsgTxt crash MATLAB (R2014b)?

1 view (last 30 days)
Jesse
Jesse on 8 Dec 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Any use of the function mexerrmsgtxt simply crashes MATLAB. I have simplified my MEX file down to a single line of code, given below.
MEX files that do not attempt to return error messages seem to work, at least based on limited testing.
I am running R2014b on MacOSX Yosemite (10.10). In order to have other things run properly, I have fully updated Xcode, which means I have gfortran 4.8.2. I realize that MathWorks says an earlier version of gfortran is the supported version, but one would hope that they would actually support the up to date version of the compilers, which are the versions their users will have.
Other than commenting out the error messages, is there any way to make this work? An internet search this morning shows that similar problems go back a long time, for many versions of MATLAB.
Source code for crasher.F is given below:
#include "fintrf.h"
SUBROUTINE MEXFUNCTION(NLHS, PLHS, NRHS, PRHS)
mwPointer PLHS(*), PRHS(*)
integer NLHS, NRHS
C
call mexerrmsgtxt('Exiting at entry')
c
return
end
  1 Comment
Geoff Hayes
Geoff Hayes on 9 Dec 2014
Jesse - I've noticed the same for R2014a on OS X 10.8.5 and so gave been using mexPrintf with a return instead of a call to mexErrMsgIdAndTxt. Not sure why this causes a crash. Do we need to declare the subroutine before calling it?

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!