- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I have 2 different FORTRAN programs (quite big programs). Let us call program 'A' and 'B'
My program 'B' needs to use a subroutine of program A (exactly the same subroutine). Is it possible to call that subroutine of A from a subroutine of B?
Any examples will be appreciated.
Peter
- Balises:
- Intel® Fortran Compiler
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
What you normally do is separate the subroutine into its own source file then either:
a) Add the source file to both of your projects/makefile for (A and B).
b) Compile the shared subroutine(s) into a Library project, then add this library (and dependency on) to both of your projects. The recommended practice in Fortran is to place the subroutine into a CONTAINS section of a module, then USE the module in A and B. The path to the .mod file must be in your INCLUDE path, the path to the resultant .obj file (when not placed into a library) may also need to be specified.
Jim Dempsey
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
If you are using Microsoft Visual Studio, you can have a single Solution that has three Projects:
one Project to build the subroutine(s) Library or Modules
one Project to build program A (dependent on the Library Project)
and one Project to build program B (dependent on the Library Project).
For debugging you then set the Startup Project to your choice of either A or B.
Jim Dempsey
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable