Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26758 Discussions

linking fortran70 and fortran95 program

nahak__pranaya
Beginner
161 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
Black Belt
161 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.

mecej4
Black Belt
161 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.

JAlexiou
New Contributor I
161 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.
Steve_Lionel
Black Belt Retired Employee
161 Views

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

Reply