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).