I have a code wriiten in Fortran 77 which I need to call in simulink using S function block.
I know that I have to write C mex file to link the fortran code. But the problem is that my compiler - Intel Parallel Studio Xe 2015- doest compile the
Fortran77 code, it, however, does succesfully compile the fortran 90 code. So my question is: is there any other compiler for matlab which can compile Fortran 77.
I am using Matlab 2018a.
Thank-you.

댓글 수: 3

James Tursa
James Tursa 2021년 10월 28일
All Fortran 90 compilers can compile Fortran 77 code, including the Intel compiler you mention. Typically, if the file extension is .f then the compiler will assume fixed format, and if the file extension is .f90 then the compiler will assume free format.
Please post exactly how you are compiling your code and what errors you are seeing.
Caveat: Last time I checked TMW still had the silly /fixed option in their Fortran compile files. You should edit these files and get rid of the /fixed option if you haven't done so already.
afaq ahmad
afaq ahmad 2021년 11월 2일
Thanks for your prompt reply. Could you elaborate on the last point "TMW still had the silly /fixed option in their Fortran compile files". How can I get rid of the fixed option?
Thanks.
James Tursa
James Tursa 2021년 11월 3일
편집: James Tursa 2021년 11월 3일
The silly /fixed option that TMW insists on including in their build files forces the compiler to interpret .f90 free format files as fixed format files, typically leading to a boat load of compile errors. To fix this, edit their build files and get rid of that option. E.g., in the matlabroot\bin\win64\mexopts directory one of the Fortran build files is named
intel_fortran_20_vs2019.xml
Edit this file and change this line
COMPFLAGS="/nologo /fpp /Qprec /fixed /MD /fp:source /assume:bscc $INCLUDE $COMPDEFINES"
to this
COMPFLAGS="/nologo /fpp /Qprec /MD /fp:source /assume:bscc $INCLUDE $COMPDEFINES"
I would do this for every Fortran build file in the directory (or whatever your particular directory is).

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2021년 10월 28일

편집:

2021년 11월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by