HP Fortran Programmer's Reference (September 2007)

BLAS and libU77 libraries
Calling libU77 and BLAS routines
Chapter 12 645
SUBROUTINE without_decl
PRINT *, TTYNAM(6) ! implicit typing is in effect
END SUBROUTINE without_decl
SUBROUTINE with_decl
! declare the return type of TTYNAM
CHARACTER(LEN=80), EXTERNAL :: TTYNAM
PRINT *, TTYNAM(6)
END SUBROUTINE with_decl
Here are the command lines to compile and execute the program, along with the output from
a sample run:
$ f90 +U77 call_ttynam.f90
$ a.out
0.0
/dev/pts/0
For information about explicit interface, see “Procedure interface” on page 181. See “Implicit
typing” on page 113 for the rules of implicit typing.
Declaring library routines as EXTERNAL
There are two cases when you should declare a library routine with the EXTERNAL attribute:
The routine name is passed to a procedure as an actual argument
The routine name is the same as an intrinsic name
The first case applies to both libU77 and BLAS routines. The second applies only to libU77
routines; as shown in Table 12-1, several of the names of libU77 routines are also those of
intrinsics. Unless you declare these routines with the EXTERNAL attribute, the compiler will
map the call to the intrinsic library.
For example, if a program unit makes a call to FLUSH, the compiler will make a call to the
intrinsic, unless the program unit includes the following statement:
Table 12-1 libU77 naming conflicts
FLUSH FREE GETARG
GETENV IARGC IDATE
LOC MALLOC SYSTEM
TIME