Intel® Fortran Compiler 16.0 User and Reference Guide

Using the IMSL Libraries from the Command Line (Windows* OS)

To use the IMSL* libraries from the command line:

  1. Set the necessary Intel® Fortran environment variables for your development environment by executing the compilervars.bat file (see Using the compilervars File to Specify Location of Components). This sets the INCLUDE path and library (linker) search paths.

  2. Add a reference to the FFLAGS environment variable to establish IMSL-compatible defaults and add a reference to the appropriate environment variable to the ifort commands used to build the sources:

    • %LINK_FNL_STATIC% for the static libraries

    • %LINK_FNL_SHARED% for the dynamic libraries

    • %LINK_FNL_STATIC_HPC% for the static libraries and Intel MKL

    • %LINK_FNL_SHARED_HPC% for the dynamic libraries and Intel MKL

    • %LINK_FNL_MPI% for the static libraries, the MPI version of error handler and MPI

    • %LINK_FNL_MPI_HPC% for the static libraries, the MPI version of error handler, MPI and Intel MKL

    • %LINK_FNL_MPIS% for the static libraries, the scalar version of error handler, MPI and Intel MKL

    • %LINK_FNL_MPIS_HPC% for the static libraries, the scalar version of error handler, MPI and Intel MKL

    For example, ifort %FFLAGS% example.f90 %LINK_FNL_STATIC%

  3. Do not change the defaults for the compiler options /fpe and /iface.

  4. Make IMSL routines and their interfaces available to your program. There are several options available for this; see the Introduction in the IMSL Fortran Library User's Guide for details.

The free-form Standard Fortran example program below invokes the function AMACH and the subroutine UMACH from the IMSL Libraries. The AMACH function retrieves real machine constants that define the computer's real arithmetic. A value for positive machine infinity is returned (Infinity). The subprogram UMACH retrieves the output unit number.

!  This free-form example demonstrates how to call
!  IMSL routines from Intel® Visual Fortran.
!
  PROGRAM SHOWIMSL
  USE AMACH_INT
  USE UMACH_INT
  INTEGER NOUT
  REAL RINFP
! The AMACH function and UMACH subroutine are
! declared in the AMACH_INT and UMACH_INT modules
  CALL UMACH(2,NOUT)
  RINFP = AMACH(7)
  WRITE(NOUT,*) 'REAL POSITIVE MACHINE INFINITY = ',RINFP
  END PROGRAM

For information on using the IMSL libraries from the IDE, see Using the IMSL Libraries from the Integrated Development Environment.