Fast connection between fortran 77 and 90

  • Context: Fortran 
  • Thread starter Thread starter querky
  • Start date Start date
  • Tags Tags
    Connection Fortran
Click For Summary
SUMMARY

The discussion focuses on connecting Fortran 77 and Fortran 90 routines for efficient data exchange. It confirms that Fortran 77 subroutines can be called from Fortran 90 using the 'call' statement, while functions must be rewritten as subroutines. The ability to call Fortran 90 code from Fortran 77 is not feasible. A compatible compiler, such as gfortran, is essential for compiling both versions of Fortran code.

PREREQUISITES
  • Understanding of Fortran 77 and Fortran 90 syntax and structures
  • Familiarity with subroutines and functions in Fortran
  • Knowledge of COMMON Blocks in Fortran 77
  • Experience with MODULE Statements in Fortran 90
NEXT STEPS
  • Research how to use gfortran for compiling mixed Fortran code
  • Learn about data exchange techniques between Fortran 77 and Fortran 90
  • Explore the implications of using COMMON Blocks and MODULES for data sharing
  • Investigate best practices for rewriting Fortran 77 functions as subroutines
USEFUL FOR

Fortran developers, software engineers maintaining legacy Fortran code, and anyone integrating Fortran 77 and Fortran 90 functionalities.

querky
Messages
1
Reaction score
0
Hi!

I'm having kind of a "little" problem. I got an old program written in Fortran77 and I want to implement some functionality from Fortran90 routines. The routines are quite long, so I'm not able to rewrite them in F77...

Is there a possibility to connect the routines so that they can communicate (exchange variable values) in a fast way.

I have though about the COMMON Blocks of F77 and the MODULE Statements in F90. Is there a way of connecting these data structures in a way, that a F90 program can read a F77 COMMON Block. (I though about a I/O-interface but I think this is too slow)

Thanks for your help!
 
Last edited:
Technology news on Phys.org
Hey

The connection between Fortran 77 and Fortran 90 is in my opinion a bit tricky. I have myself succeeded to call Fortran 77 subroutines from Fortran 95 (I assume it works in Fortran 90 also) by using the 'call' statement. I have not succeed to call the Fortran 77 functions but I had to rewrite them as subroutines instead. I don't think it is possible to call Fortran 90 code from Fortran 77. To compile the code I think you need a compiler which is able to compile both Fortran 77 and Fortran 90 code, e.g. gfortran
I hope this helps
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 34 ·
2
Replies
34
Views
5K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 8 ·
Replies
8
Views
6K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K