- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's a fourth - just call it - if the implicit interface is acceptable.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page