http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47495

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-29 
12:04:10 UTC ---
(In reply to comment #4)
> For starters it would be nice if gfortran would even document its precise
> semantics for when module files are created/updated/etc. [...] This is PR 
> 42607.

In a nutshell:

a) When a MODULE is compiled*, gfortran generates a file consisting of the
lower-cased module name and the suffix ".mod". The file is placed into the
current working directory, unless the -J option is used.

b) A .mod file is read when a USE statement is encountered; the file must exist
and is searched for in the include search paths.

c) If a MODULE is compiled again, but an existing .mod file would not change,
the file modification date is not modified.

d) Module files (.mod) contain the public procedure interfaces, type
declarations and module variables of the module, including those made
accessible via USE statements within the module

[(c) and the second part of (d) are design choices, also the exact data which
is saved in the file; the rest nearly all compiler handle in the same way.]
[* MODULE = a "MODULE module_name; ...; END MODULE" block in a file; a file can
contain multiple modules - or none.]

  * * *

I think it would be useful to give an example Makefile file in the manual.
Joost's solution (comment 2) seems to work fine, though I am not sure how
protable to non-Unix platforms the "@true" is.

Reply via email to