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

(UN)Compatibility with MatLab DD Link for old versions such as 7.1

pom34
Beginner
679 Views
I was compiling a fortran program with the Digital Fortran 6.6, and using the DDE link with MatLab engine. This was working great.
I am now using the Intel Fortran compiler 11.1 and this is not working any more. I have been fighting with this for several days now and need some help from experts !
First I had external unresolved messages when linking. I had a look inside the MatLab dll and lib used and have seen a problem with uppercase of symbol names. I then added INTERFACES for all the used MatLab functions with code such as :

INTERFACE

INTEGER FUNCTION MATOPEN()

! return a pointer (File handle, or 0 if the open fails)

$ATTRIBUTES C,VARYING,DLLIMPORT,ALIAS:'_matOpen'::MATOPEN

END FUNCTION MATOPEN

END INTERFACE

It seems the Fortran Digital was less picky about lower/uppercase of symbols than Fortran Intel does.
This way I could solve the linking problem. Got an exe and coul run it.
I can even, using the obtained program, open and close the MatLab engine using the corresponding command of the DDE link, BUT I AM UNABLE TO PASS VARIABLES. I get an unhandled win32 exception error and my program stops for exemple with functions such as engEvalString, or mxCopyReal8ToPtr. For some example you can search for the fengdemo.F code example.
Is there a way to solve this ? or Intel v11.1 and MatLab 7.1 are definitely incompatible ?

Thanks

0 Kudos
4 Replies
Steven_L_Intel1
Employee
679 Views
It is not true that the Intel compiler is more "picky" about name case than Digital Visual Fortran - they are the same in that regard. If your version of Matlab was built for use with DVF, you probably need a new one for compatibility with any other Fortran compiler, including Intel's. I expect that Matlab provided a module for you to use with declarations of the routines, which you could not use with the Intel compiler.

Please contact Mathworks support for help in determining which version of Matlab is compatible with Intel Visual Fortran 11.1.
0 Kudos
pom34
Beginner
679 Views
Dear Steve,

Thanks for your answer. Mathworks indeed indicates some combination of compatibility between some Fortran compilers and some versions of the MatLab engine, for eg at:

http://www.mathworks.com/support/compilers/R2009b/

But I guess they just list some of them that they garanty and that they have tested. But I guess this is not an exhaustive list. Fortran Intel 10.* or 11.* and MatLab 7.1 is not garantied in this list (for MatLab 7.1 they garanty compatibility with Fortran Digital 5 or 6), but I was hopping to be able to go through. I guess I am not very far for managing, since I could solve the external unresolved problem with the INTERFACE definition and ALIAS keyword, and I can open and close MatLab from my compiled fortran code. I "just" need now to be able to exchange variables. Is there any idea to solve this? I am wondering if this is due to a different coding of integers, real and characters between the fortran code and the MatLab dll.

Thanks in advance.

0 Kudos
pom34
Beginner
679 Views
Continued:

this is the compatibility list for Fortran compilers for MatLab 7.1:

http://www.mathworks.com/support/compilers/1601_71.html

It seems from this page that MatLab 7.1 was compiled with Microsoft Visual C/C++ .NET 2003 (7.1) Professional Edition. Is there any pb to use it with stuff compiled with Intel 10.* or 11.* ?

Best regards.
0 Kudos
Steven_L_Intel1
Employee
679 Views
This should work then. Is it possible that you had some compiler option set with DVF that you did not use with Intel Fortran? For the routine you mentiioned, you don't need the ATTRIBUTES C - it is forcing pass by value. Try this:

!DEC$ ATTRIBUTES DLLIMPORT,DECORATE,ALIAS:'matOpen'::MATOPEN
0 Kudos
Reply