To mix f77 and f95 object binaries, link with f95 compiler and the -xlang=f77 option. Perform the link step with f95 even if the main program is an f77 program
Example: Compiling an f95 main program with an f77 object file.
demo% cat m.f95 CHARACTER*74 :: c = ’This is a test.’ CALL echo1( c ) END demo% f95 -xlang=f77 m.f95 sub77.o demo% a.out This is a test. demo%
The FORTRAN 77 library and intrinsics are available to f95 programs and are listed in the Fortran Library Reference Manual.
Example: f95 main calls a routine from the FORTRAN 77 library.
demo% cat tdtime.f95 REAL e, dtime, t(2) e = dtime( t ) DO i = 1, 100000 as = as + cos(sqrt(float(i))) END DO e = dtime( t ) PRINT *, ’elapsed:’, e, ’, user:’, t(1), ’, sys:’, t(2) END demo% f95 tdtime.f95 demo% a.out elapsed: 0.14 , user: 0.14 , sys: 0.0E+0 demo%
See dtime(3F).
The Fortran standard supports intrinsic functions that FORTRAN 77 did not have. The full set of Fortran intrinsics, including non-standard intrinsics, appears in the Fortran Library Reference manual.
If you use any of the intrinsic names listed in the Fortran Library Reference as a function name in your program, you must add an EXTERNAL statement for f95 to use your routine rather than the intrinsic one.
The Fortran Library Reference also lists all the intrinsics recognized by earlier releases of the f77 compiler. The f95 compiler recognizes these names as intrinsics as well.
Compiling with -f77=intrinsics limits the compiler’s recognition of intrinsic functions to just those that were known to the f77 compiler, ignoring the Fortran intrinsics.