Silverfrost Forums

Welcome to our forums

Module compilation dependencies

6 Sep 2006 1:47 #987

Hi,

I make a lot of use of modules but am having real issues with the compiler needing to re-compile every program unit that uses a module when I make even the slightest change to it that does not affect the interface - this makes extensive use of modules very difficult in a large program. The FTN95 help states that 'If a module is changed in a way that does not affect the interface then program units that use that module do not need to be recompiled' (at the bottom of the 'Fortran 95 language overview/Modules' page). If this really is true, can anyone tell me why it doesn't appear to be working in the example below - here I have one module and one program unit in 2 files. Whenever I change anything in the module (eg. adding an extra . to the 'hello world' string), the entire program recompiles...

Thanks, Alan Williams

! File Module1.f90 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Module dependency test - The Module module Module1

interface subroutine OutputStuff() end subroutine OutputStuff end interface

contains

! Output a message subroutine OutputStuff() write(,) 'Hello world.......' end subroutine OutputStuff

end module Module1

! File ModuleDepTest.f90 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Module compilation dependency test program ModuleDepTest use Module1 ! any change causes recompile

write(,) 'Testing module compilation depencies' call OutputStuff() end program ModuleDepTest

6 Sep 2006 2:00 #988

Alan

If I understand your situation correctly the problem concerns how Plato (or Visual Studio) works. The compiler does not do any dependency checking. The IDE assumes the worst case - any change causes all related files to be recompiled. However, in Plato you can switch off the dependency checking from the Project menu (I assume that you can do the same in VS).

6 Sep 2006 2:17 #989

Paul

I'm using Visual Studio I'm afraid. I'm not aware of any way of 'turning off' the dependency checking - the only option I can find in the project properties is 'prevent module dependency checking' (which is set to no by default, setting to yes make no obvious difference). I'm not sure I understand how the system is supposed to work though - surely the dependency checking is down to the VS/FTN95 plugin - there must be some Fortran-specific part that sets up all the dependencies and decides whether the module has changed sufficiently to require all dependencies to be compiled. Or is this something that will only work if I use makefiles ? (if so it would be helpful to put a note in the help file saying as much).

6 Sep 2006 5:05 #990

Alan

It looks like 'prevent module dependency checking' is intended to do the trick in normal use (not with makefiles). This is programmed into the VS/FTN95 plug-in as one would expect. If you are sure that it is not working then we will need to provide a fix.

6 Sep 2006 6:28 #991

Paul,

I've double-checked - all the option does is prevent any dependency checking - if its set to yes then all files are recompiled in the order in which they appear in the solution, irrespective of whether they have been modified or any dependencies have been altered.

However, I did manage to get the proper behaviour to occur for a while - it worked well until I did a rebuild all and since then its been misbehaving again. It even recompiles the main file if I just add a newline or space after the module. I will email you my full source and VS2003 project files for the above example - when I unzip it here to a completely new folder it misbehaves from the start. Any workaround or a fix would be hugely appreciated.

Please login to reply.