When porting a 32 bit application to 64 bit using Salford ftn95 8.40, we ran into a problem in context with a special module situation.
We have a fortran file consisting only of a module definition defining and initialising 2 variables. The module is used in a second (main) source which displays both variables of the module. It depends on the way we build the stuff if the output values are corect or not. Especially we cannot build a library consisting only of the object file built from the module file.
Module source file (mod_def.for):
MODULE MYMOD
REAL*8 :: VAR1 = 10D0
REAL*8 :: VAR2 = 20D0
END MODULE
Main source (mymodules1.for):
use mymod
write(*,*) 'VAR1=',VAR1
write(*,*) 'VAR2=',VAR2
end
Using link file mod_def.lnk
lo mod_def.obj
;lo mymodules2.obj
file mod_def.lib
causes an access violation when trying to create library mod_def.lib. Adding/decommenting loading file mymodules2.obj in the link file makes the library be generated as expected. Here mymodules2.for contains a function not used in the main program.
The main executable is created using link file
lo mymodules1
;lo mod_def.obj
lo mod_def.lib
file mymodules1.exe
Now executing mymodules1.exe results in the values 0.00000000000 for both VAR1 and VAR2. If I load object file mod_def.obj instead of mod_def.lib when linking mymodules1.exe and execute mymodules1.exe, then the proper output
VAR1= 10.0000000000
VAR2= 20.0000000000
is displayed.
This is not a serious problem for we can use the module object file in the context of our port mentioned above. However, originally we intended to use an analogon to the module file situation above where the module object file was contained in a library and this caused the wrong initialisation.
Regard, Dietmar