Thanks to a very useful post in this forum, there is now a very simple way to use ifc and MATLAB .mex files together.
A .mex file is a compiled Fortran (or C) subroutine which is linked in with the MATLAB binary at run-time allowing you to use user-defined pre-compiled code with MATLAB.
It is somewhat of a pain to to interface but MATLAB has good documentation for doing it in Fortran 77.
I had some code in F95 which I wanted to have work with MATLAB as well. The trick in getting it to link is the undocumented -static-libcxa linking option.
Attached is my "mexopts.sh" file. Basically all you need
to change in the 'glnx86' section is FC to
For some reason it is not attaching it as mexopts.sh but that is the file name it should be to work in MATLAB.