Hi
I wanted to use an old F77 subroutine package in my new Fotran code and I could compile it with minimal changes but when I tried to link it with the rest of the code I got a strange error from the linker
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: lmdif1lib.o: bad reloc address 0x20 in section `.eh_frame'
It took some time to reallize that this was due to the fact that inside some of the F77 routines two functions had been declared as
DOUBLE PRECISION ENORM,DPMPAR
where ENORM and DPMPAR were functions in the same package. When I removed this declaration the linking went smoothly.
I have noticed earlier that one should not declare function types inside the subroutine they are used in gfortran but as this was necessary in F77 I missed this declaration when I converted the code. And the error message is not very clear or informative, except that the functions also appeared as undefined references. There is a similar problem with the EXTERNAL declaration.
This is just a hint to others with the some problem or the gfortran developers if they read this. I do not think it is really a FAQ.
I wanted to use an old F77 subroutine package in my new Fotran code and I could compile it with minimal changes but when I tried to link it with the rest of the code I got a strange error from the linker
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: lmdif1lib.o: bad reloc address 0x20 in section `.eh_frame'
It took some time to reallize that this was due to the fact that inside some of the F77 routines two functions had been declared as
DOUBLE PRECISION ENORM,DPMPAR
where ENORM and DPMPAR were functions in the same package. When I removed this declaration the linking went smoothly.
I have noticed earlier that one should not declare function types inside the subroutine they are used in gfortran but as this was necessary in F77 I missed this declaration when I converted the code. And the error message is not very clear or informative, except that the functions also appeared as undefined references. There is a similar problem with the EXTERNAL declaration.
This is just a hint to others with the some problem or the gfortran developers if they read this. I do not think it is really a FAQ.