Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Specify Consistent Library Types on Windows

There are a number of Visual C++* runtime libraries that offer the same entry points but have different characteristics. The default Visual C++* library is libcmt.lib, which is multi-threaded, non-debug, and static.

The Intel® Visual Fortran and Microsoft* Visual C++* libraries must be the same types. The incompatible types are listed below.

  • Mixing static and dynamic-link versions of the libraries.

  • Mixing debug with non-debug versions of the libraries.

The default Intel® Visual Fortran libraries depend on the project type:

Fortran Project Type

Default Libraries Used

Fortran Console

Static, multi-threaded libraries libifcoremt.lib and libcmt

Fortran Standard Graphics

Static, multithreaded libraries libifcoremt.lib and libcmt.lib

Fortran QuickWin

Static, multithreaded libraries libifcoremt.lib and libcmt.lib

Fortran Windows

Static, multithreaded libraries libifcoremt.lib and libcmt.lib

Fortran DLL

Dynamic-link libraries libfcoremd and msvcrt (and their import libraries)

Pure Fortran applications can have mismatched types of libraries. One common scenario is a Fortran Windows* application that is linking with a Fortran static library. This can cause link-time conflicts as well as undesired runtime failures. The Fortran library should be rebuilt as a dynamic library to avoid these issues.

Similarly, different C/C++ applications link against different C libraries. If you mix the different types of applications without modifying the defaults, you can get conflicts. The debug version of a library has a letter d appended to its base file name:

  • Static, multithreaded: libcmt.lib and libcmtd.lib

  • Dynamic-link libraries: msvcrt and msvcrtd (.lib import library and .dll)

When using a Debug configuration, Visual C++* selects the debug libraries.

The Intel® Visual Fortran Compiler does not select debug libraries for any configuration, but provides settings that allow you to request their use. To specify different types of Fortran libraries in the IDE, select Project > Properties, then select the Libraries category on the Fortran tab:

  • To specify static libraries, select the appropriate type of static (non-DLL) library under Runtime Library (see /libs:static).

  • To specify dynamic-link libraries, select the appropriate type of DLL library under Runtime Library (see /libs:dll).

  • To specify the debug libraries, select the appropriate type of Debug library under Runtime Library (see /[no]dbglibs). If you specify debug libraries (/dbglibs) and also request DLL libraries (/libs:dll), be aware that this combination selects the debug versions of the Fortran DLLs. These Fortran DLL files have been linked against the C debug DLLs.

  • When you specify QuickWin or Standard Graphics libraries under Runtime Library, this selection implicitly requests multithreaded libraries.

NOTE:
This option does not cause static linking of libraries for which no static version is available, such as the OpenMP runtime libraries on Windows* or the coarray runtime libraries. These libraries can only be linked dynamically.

See also Building Intel® Fortran C Mixed-Language Programs on Windows* Systems.