To use the IMSL libraries, you need to:
DFVARS.BAT
file (see Using the Compiler
and Linker from the Command Line). This sets the INCLUDE path and library (linker)
search paths.
Within the Fortran Command Prompt (command-line window) in the Compaq Visual Fortran program folder, the DFVARS.BAT file is already executed. Within the visual development environment, the equivalent of DFVARS.BAT file (as installed by Visual Fortran) is executed. You can view these directory paths within the visual development environment by:
Alternatively, if you wish to explicitly include the IMSL libraries, do the following in the visual development environment:
imsl.lib imsls_err.lib imslmpistub.lib
USE numerical_libraries
When you add the USE numerical_libraries
line to your program, you should
not declare the called routines as external with the EXTERNAL statement.
For more details, see the IMSL readme
file in the Visual Fortran program folder.
When calling Mathematics and Statistical library routines, you do not need to declare the functions or subroutines separately.
USE IMSLF90
For more information about calling the Fortran 90 MP routines, see the IMSL Libraries online
PDF file.
The free-form Fortran 95/90 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 Visual Fortran.
!
! The module numerical_libraries includes the Math and
! Stat libraries; these contain the type declarations
! and interface statements for the library routines.
PROGRAM SHOWIMSL
USE NUMERICAL_LIBRARIES
INTEGER NOUT
REAL RINFP
! The AMACH function and UMACH subroutine are
! declared in the numerical_libraries module
CALL UMACH(2,NOUT)
RINFP = AMACH(7)
WRITE(NOUT,*) 'REAL POSITIVE MACHINE INFINITY = ',RINFP
END PROGRAM
For information on compiling and linking with the visual development environment, see Building Programs and Libraries.