Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

linking fortran70 and fortran95 program

nahak__pranaya
Beginner
538 Views

I have a main program written in fortran70 in'.F' extension file. Now i'm trying to call a subroutine which is written in fortran90 in another file with '.f90' extension. I compile both the programs using make file in intel compiler. It is getting compiled also. But when i'm trying to transfer some data from the main program to subroutine and vice-versa through the argument list, the data transfer is not happening at all(Though the program runs). What's the problem or how to link the F77 main code with the f90 subroutine?

0 Kudos
4 Replies
IanH
Honored Contributor II
538 Views

Show some code, at least the relevant declarations and the statement that invokes the procedure, and the relevant declarations that define the characteristics of the called procedure.

0 Kudos
mecej4
Honored Contributor III
538 Views

There were many versions of Fortran available in the early 1970-s, but none of them had the name Fortran-70. Fortran IV and Fortran-66 come to mind.

The file extensions .f and .f90 only signify whether the source file is "fixed format" or "free format", not the version of the Fortran standard.

As IanH said, show some code.

If the subroutine uses Fortran 9X features that make an explicit interface necessary, and the caller did not provide that interface, the subroutine arguments will not be passed correctly.

0 Kudos
JAlexiou
New Contributor I
538 Views

There are three ways to call a procedure in Fortran (regardless if it's in a separate file, or appended to the end after the main program).

  • Declare the procedure name as `external` in the program declarations.
  • Define an interface for the procedure.
  • Define the procedure inside a module and use the `use` keyword.
0 Kudos
Steve_Lionel
Honored Contributor III
538 Views

There's a fourth - just call it - if the implicit interface is acceptable.

0 Kudos
Reply