The catch is that the onemod.mod file must be available toĪll the other subprograms that use that module. Pretty short: gfortran and ifort), this interface file has the In all Fortran compilers I have access to (sadly, the list is Is compiled, it generates a file containing the interface of the When other parts of the program use onemod, the routineĪddone is available to them through host association. This is straightforward: Module onemod defines subroutineĪddone. Module onemod implicit none contains subroutine addone ( msg, n ) character ( len = :), allocatable, intent ( inout ) :: msg integer, intent ( inout ) :: n msg = msg // "1" if ( n > 1 ) then n = n - 1 end if end subroutine addone end module onemod Implementation, and ii) prevent circular dependencies betweenĬonsider module one contained in source file one.f90: Submodules are: i) separate the interface of a module from its Recently fixed important submodule-related bugs). Only recently implemented in modern Fortran compilers (this is earlyĢ019, gfortran has had them for a long time and ifort has only Works for all Fortran standards from F77 up to the latest.įortran submodules were introduced in the 2008 Fortran standard and Includes that include modules and submodules. Packing more than one module and submodule inside the same file. Using modules, submodules, and includes with arbitrary dependenciesĪmong them, even across different subdirectories in the project Parallelization using with make’s -j or -l command-line options. With a few restrictions, this solution permits: Programs for the Makefiles to work correctly. On macOS, you may need to download the GNU versions of these Note: these Makefiles use tools such as GNU awk (gawk), GNU find, and These notes show how to write portable Makefiles for large modern Rule 7: submodule anchor files depend on their parent’s anchor files.Rule 6: submodule anchor files depend on their ancestor’s anchor files.Rule 5: the anchor of a source file depends on the anchors of all the non-intrinsic modules it uses.Rule 4: the anchor of a source file depends on all its included files and their contents.Rule 3: the anchor of a source file depends on the smod file of those of its submodules that are parents of a submodule.Rule 2: the anchor of a source file depends on the smod file of those of its modules that are ancestors of a submodule.Rule 1: the anchor of a source file depends on the mod files of its modules.Multiple modules and submodules in the same file.Handling several different file extensions.Compiling across directories and hiding.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |