How to get MATLAB .mex files to work with ifc: answer in here!

How to get MATLAB .mex files to work with ifc: answer in here!

Thanks to a very useful post in this forum, there is now a very simple way to use ifc and MATLAB .mex files together.

Background:

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
FC='ifc -static-libcxa'
and
LD='ifc -static-libcxa'

For some reason it is not attaching it as mexopts.sh but that is the file name it should be to work in MATLAB.

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.