Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

Using Intel Fortran Compiler with Microsoft Visual C++

Jernej_B_
Beginner
413 Views

I am developing a C++ application using Microsoft Visual C++ in Microsoft Visual Studio 2015. From my C++ application, I need to call some numerical software written in Fortran. This software is free and publicly accessible, and full Fortran source code is available for it. I am considering purchasing the Intel Fortran Compiler to compile the Fortran source code. I'd like to produce a static library, which I will then link against my Visual C++ application.

My question is: Will I be able to call the Fortran library (compiled with the Intel Fortran Compiler) from Microsoft Visual C++ ?

I know that if I was using Intel's C++ compiler that I could then link against Intel Fortran-compiled code. However, it is not practical for me to switch to the Intel C++ compiler. Can I continue using Microsoft Visual C++, and link against a Fortran static library produced using the Intel Fortran Compiler? Will this solution require me to distribute (to my customers) some run-time DLLs from Intel Fortran?

Thank you. 

 

 

0 Kudos
4 Replies
gib
New Contributor II
413 Views

You certainly can link Intel Fortran libraries from MSVC code.  I'm not sure about the issue of Intel run-time DLL license.

IanH
Black Belt
413 Views

What gib says, plus...

If you are producing a single exe from the combination of the C++ and Fortran, then you don't need to use the DLL form of the runtimes, you can just statically link the runtimes in.

The DLL form of the Fortran (and C++, same issues really) runtimes is typically required when your program has say an EXE and one or more DLL's written in Fortran (or C++), and the EXE and DLL's interact with each other in anything other than a trivial manner.

If you do use the DLL form of the Fortran (and C++) runtimes, then you need to distribute the Fortran (and C++) runtimes.

TimP
Black Belt
413 Views

If you have a full license (not evaluation or student license), you are entitled to distribute the shared libraries either by the distributable package offered with your compiler on the download site or by including the required components in your distribution.

Steve_Lionel
Black Belt Retired Employee
413 Views

See https://software.intel.com/en-us/articles/configuring-visual-studio-for-mixed-language-applications for details on configuring MSVC for linking to Intel Fortran code. I highly recommend specifying that the Fortran code link to the shared libraries as the MSVC code will also be doing that. Be aware that in recent Visual Studio versions, C++ projects will not automatically link in the output libraries of dependent projects, so you'll have to explicitly add the Fortran .lib to your C++ project. Make sure that you don't mix debug and release configurations.

Reply