Ways to suppress Circularity

When using modules (as opposed to the F77-style procedures), you get explicit interfaces —i.e., the procedure signatures and their invocations get proper/better checking from the compiler.

But in Fortran, modules also provide encapsulation (public | private and protected).

Of the 700+ procedures you have, probably only a handful need to be exposed for public USE, while the rest can remain private. If that’s the case, then the single-module-multiple-submodules approach works for you.

(As of now, gfortran has a submodule-related bug when submodules try to access symbols declared in the parent module)

Otherwise, if most or all of the 700+ procedures need to be made public, then you’re better off keeping them in separate files and maybe providing modules with just the interface blocks. This is what LAPACK95 does, btw.

1 Like