Why does running a MEX file on MacOS crash MATLAB when mexerrmsgtxt is used?

1 vue (au cours des 30 derniers jours)
Jeff Freymueller
Jeff Freymueller le 11 Août 2016
Commenté : Jeff Freymueller le 11 Août 2016
Passing an error message back from a MEX file using mexerrmsgtxt from FORTRAN crashes MATLAB completely. I observed the same problems with R2014b and R2016a. I can only replicate the latter one because I have a current version of Xcode. Below is a stripped down version of a MEX function that does nothing but return an error message, and yet still crashes.
I am currently running OS X 10.11.6, Xcode fully updated, MATLAB R2016a freshly installed. I had the same problem a year ago with an older version of OS X and R2014b. The formatted text for some reason puts the #include statement outside of the formatted text, but it is the first line of the file.
Compiled within MATLAB using mex crasher.F
#include "fintrf.h"
SUBROUTINE MEXFUNCTION(NLHS, PLHS, NRHS, PRHS)
mwPointer PLHS(*), PRHS(*)
integer NLHS, NRHS
C
call mexerrmsgtxt('Exiting at entry')
c
return
end

Réponses (1)

Philip Borghesani
Philip Borghesani le 11 Août 2016
Modifié(e) : Philip Borghesani le 11 Août 2016
What FORTRAN compiler and version are you using? The only supported compiler I see is Intel FORTRAN Composer XE (2013) Supported Compilers. The reason for the limited list is a known incompatibility in exception handling models for other compilers: Any error thrown during mex execution may take down MATLAB.
  1 commentaire
Jeff Freymueller
Jeff Freymueller le 11 Août 2016
gfortran, which I now see has disappeared from the supported list. (It was on the list for 2014b, which had the same failure).
However, despite fortran supposedly not being supported, when I ran
mex --setup FORTRAN
MATLAB claimed that it had identified a compiler and was set up to use it. So there was no warning that it was trying to use an unsupported compiler.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by