I am trying something that is not supported. I want to use the NAG Fortran compiler (release 5.3.1) to mex a Fortran file.
Using the command:
nagfor -ideclient -abi=64 -compatible -fpp -I"C:\Program Files\MATLAB\R2013b\extern\include" -Wl,-shared -thread_safe -L"C:\Program Files\MATLAB\R2013b\bin\win64" timesto.F -lmx -lmex -lmat -o timesto.mexw64
I am able to compile and link an adapted version of the timestwo.F
Fortran example.
I used the very simple code below and this works well.
#include "fintrf.h"
subroutine mexFunction(nlhs, plhs, nrhs, prhs)
C Declarations
implicit none
C mexFunction arguments:
mwPointer plhs(*), prhs(*)
integer nlhs, nrhs
call mexEvalString('why')
end
Notice that mexEvalString
is a function.
If I now change
call mexEvalString('why')
into
call mexErrMsgTxt('why')
The compilation still works. However, Matlab crashes without giving any indication why.
The only difference I see between both statements is that one contains a subroutine instead of a function.
What is going wrong and how do I fix this?