The question is obvious I think, although I googled it, I could not find any solutions. I want to split my source code to keep it more maintainable. How can I reference a module in another file?
How to include a module from a different file in Fortran 95?
6.8k Views Asked by Hasan At
1
There are 1 best solutions below
Related Questions in FORTRAN
- Writing code for River Section Coordinates in Fortran
- How to get size of array directly from Fortran to R?
- OpenMP multi-threading not working if OpenMPI set to use one or two MPI processor
- Problems with converting old Fortran code
- Why is my code crashing with "Illegal address during kernel execution" when I use subroutines to copy or deallocate members of derived type variables?
- Getting distances of points in 2D space in an array in Fortran using the concept of broadcasting (Python)
- Conflict between lexer rules in ANTLR4 for Fortran grammar
- how to automatically generate a Module from a project in Visual Studio
- I am encountering an f2py dimension error when passing numpy array to fortran
- Why is there an error with gfortran but ifort and pgf90 do not?
- Parallelize nested loop with running sum in Fortran
- Calling c++ from fortran
- Visual Studio Code Not Recognizing findent Installation for Modern Fortran Extension Despite Correct Python Interpreter and PATH Configuration
- Different floating point representations of identical 64 bit double precision numbers
- How to define a Function in Fortran
Related Questions in FORTRAN95
- Fortran DO loop, warning to use integer only
- How do I extract a floating number in the middle of an alphanumeric chain?
- Need help debugging writing to a file in fortran
- How to write a genfromtxt with f2py?
- What is the purpose of result variables in Fortran?
- How to initialize array of integer kind 8 in fortran?
- Saving own Types inside Arrays
- Fortran Bus Error on allocating a large matrix (gfortran)
- Can't find libgfortran-3.dll in Fortran
- Another "Expected a right parenthesis in expression at (1)"
- Replacement for obsolete "statement functions" in Fortran 95 and later?
- Fortran 95: inline evaluation of if-conditions
- Fortran 95 Do-While Loop Not Exiting on False Condition
- Reading multiple files in Fortran 95
- Matrix line and column seem to be printed inverted in Fortran
Related Questions in SILVERFROST-FORTRAN
- Calling Fortran DLL in Matlab with the help of C++
- Fortran Silverfrost compiler creates .exes that can't be deleted
- Double precision in Fortran for trignometric functions
- Does GMP work with gfortran? Is there an arbitrary precision arithmetic option for Silverfrost Fortran?
- Defining a subroutine in another subroutine
- What software is required for compiling Matlab mex file from Fortran Silver-frost FTN95 project?
- How to avoid undefined reference when linking objects in cyclic dependencies in Gfortran
- Why are resulsts of silverfrost and gfortran different?
- Attempt to call a routine with argument as a procedure when a real was required
- Debugging access violation error: writing to 2071E05A0 instead of 3071E05A0
- How to include a module from a different file in Fortran 95?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I think that you are looking for the
usestatement. You might, for example, have one source file containing the definition of a module, outline:and then, in another source file, a program which uses the module, outline:
Note:
Any
usestatements precede theimplicitstatement.The
usestatement refers to the module by name.When it comes to compilation, make sure that you compile the module source file before the program source file; at compilation time (not at link time) the compiler will look for a module file (often called a
modfile) to satisfy the reference to the module in theusestatement. Themodfile is a bit like a header file, but it's created by the compiler.Later, when you link your program you'll need the object files for both module and program.