To build a multithread application that uses the Fortran run-time libraries, specify the -threads (Linux* and Mac OS*) or /threads (Windows*) compiler option from the command line. For Windows systems, you can use also use the Microsoft integrated development environment (IDE), as described later in this topic.
You must also link with the correct library files.
The following applies to Linux and Mac OS systems:
To create statically linked multithread programs, link with the static library named libifcoremt.a. To use shared libraries, link your application with libifcoremd.so (Linux) or libifcoremd.dylib (Mac OS).
The following applies to Windows systems:
To create statically linked multithread programs, link with the re-entrant support library LIBIFCOREMT.LIB. To use shared libraries, use the shared LIBIFCOREMD.DLL library, which also re-entrant, and is referenced by linking your application with the LIBIFCOREMD.LIB import library.
Programs built with LIBIFCOREMT.LIB do not share Fortran run-time library code or data with any dynamic-link libraries they call. You must link with LIBIFCOREMD.LIB if you plan to call a DLL.
Additional Notes for Windows systems:
The /threads compiler option is automatically set when you specify a multithread application in the visual development environment.
Specify the compiler options /libs=dll and /threads if you are using both multithreaded code and DLLs. You can use the /libs=dll and /threads options only with Fortran Console projects, not QuickWin applications.
To compile and link your multithread program from the
command line:
ifort -threads mythread.f90 (Linux and Mac OS)
ifort /threads mythread.f90
(Windows)
To compile and link your multithread program using
the IDE (Windows):