------- Comment #1 from dfranke at gcc dot gnu dot org  2009-12-04 23:28 -------
How about this (somewhat constructed) example:

! interface module, file (a)
MODULE M
  PRIVATE :: two
CONTAINS
  SUBROUTINE one(a)
    integer :: a
  END SUBROUTINE one
  integer FUNCTION two()
  END FUNCTION two
END MODULE

! implementation, file (b)
SUBROUTINE one(a)
  USE M
  integer :: a
  a = two()
END SUBROUTINE one

integer FUNCTION two()
  two = 42
END FUNCTION two

! another user of the function, without using the interface module, file (c)
SUBROUTINE three(a)
  integer :: a
  a = two()
END SUBROUTINE three


I often use modules simply to provide interfaces for subroutines implemented in
other files and compiled into libraries, then distributing the interface
modules together with the library to avoid issues with .mod files of varying
compiler versions.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org


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

Reply via email to