Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Fortran calls Matlab

opensesame
Beginner
988 Views
I write a file in Fortran, which calls Matlab engines. I used mex -f xxxx.for to compile the file. However, in matlabibwin32mexopts directory, there is no compiling file for the Fortran version I used (Compaq Visual Fortran 6.6), there is a compliling file df60eng matopts.bat only which is for digital visual fortran 6.0. Can anyone tell me how to write a compiling file for compaq visual fortran 6.6 or just provide me with such a compiling file?
Thanks for expert help!
0 Kudos
6 Replies
opensesame
Beginner
988 Views
>> mex -f c:matlab6p1inwin32mexoptsdf60engmatopts.bat engine_demo.for
Microsoft Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

engine_demo.obj
LINK : fatal error LNK1104: cannot open file "dfor.lib"

C:MATLAB6P1BINWIN32MEX.PL: Error: Link of 'engine_demo.exe' failed.


??? Error using ==> mex
Unable to complete successfully
0 Kudos
durisinm
Novice
988 Views
What is the mex command? Is it something MATLAB provides?

Mike
0 Kudos
Jugoslav_Dujic
Valued Contributor II
988 Views
Yes, mex is provided by Matlab. Here's a relevant excerpt from df60engmatopts.bat:

rem ********************************************************************
rem General parameters
rem ********************************************************************
set MATLAB=%MATLAB%
set DF_ROOT=%DF_ROOT%
set PATH=%DF_ROOT%Commonmsdev98in;%DF_ROOT%DF98BIN;%DF_ROOT%VC98BIN;%PATH%
set INCLUDE=%DF_ROOT%DF98INCLUDE;%INCLUDE%
set LIB=%DF_ROOT%DF98LIB;%DF_ROOT%VC98LIB;%LIB%

rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=fl32
set OPTIMFLAGS=-Oxp -DNDEBUG
set DEBUGFLAGS=-Zi
set COMPFLAGS=-c -G5 -4R8 -nologo
set NAME_OBJECT=/Fo

rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%externlibwin32digitaldf60
set LINKER=link
set LINKFLAGS=/LIBPATH:"%LIBLOC%" libmx.lib libmat.lib libeng.lib
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT="/out:%OUTDIR%%MEX_NAME%.exe"
set RSP_FILE_INDICATOR=@

To me, it seems that linker cannot find dfor.lib since environment variables are not set for some reason. I
think an easy workaround would be to add
set %DF_ROOT%="C:Program FilesMicrosoft Visual Studio"
at the beginning.

Jugoslav
0 Kudos
opensesame
Beginner
988 Views
can you provide more details? Can you insert that line in the bat file? I tried it, but I may use the wrong format of your sentence. The command is reported to have syntax error.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
988 Views
Yep, I forgot syntax of batch files a bit -- haven't used them for years. Should be just

set DF_ROOT=C:Program filesMicrosoft Visual Studio

That seems to give correct LIB & INCLUDE variables -- didn't try MEXing anything. I think you should've done "Update environment variables" step during CVF setup, but I don't know how to do it at later time (other than re-running the setup).
0 Kudos
Steven_L_Intel1
Employee
988 Views
To add the environment variables systemwide on Windows NT, 2000, Me and (I think) XP, use the program at http://www.compaq.com/fortran/kb/q1038.html to do it. On Windows 95/98, add a call to DFVARS.BAT (found in the DF98BIN folder) to AUTOEXEC.BAT.

Steve
0 Kudos
Reply