Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29282 Discussions

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

mbkennel
Beginner
417 Views
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.
0 Kudos
0 Replies
Reply