something strange with g77 compiler

Toon Moene toon@moene.indiv.nluug.nl
Sat Nov 21 06:47:00 GMT 1998


>  Using these files what I have giving make command is:
>  cd /home/piccardi/pamela/ make g77 -g -Wall  -fvxt
>  -fno-automatic  -o prova openfile.f posfile.f readfile.o
>  /tmp/cca068641.o: In function `MAIN__':
>  /home/piccardi/pamela/openfile.f:27: undefined reference
>  to `readfile_' collect2: ld returned 1 exit status make:
>  *** [prova] Error 1
>
>  Compilation exited abnormally with code 2 at Fri Nov 20
>  16:56:44
>
>
>  if I change the C subroutine name from:  void readfile(int
>  *fd, int *pos, char *buffer, int *bytes){ to:  void
>  readfile_(int *fd, int *pos, char *buffer, int *bytes){
>  everything works fine.

Yes, this is the way it is supposed to work - it is even documented  
in the manual and can be subverted by compile time switches (at  
your own risk).

The reason behind this behaviour is to have a simple means to keep  
the namespaces of C and Fortran routines separate, in a way that's  
typical of the UNIX Fortran compilers "out there".

Of the Fortran compilers I regularly use (on Digital UNIX, SGI  
IRIX, FUJITSU, Cray UNICOS, only the latter uses a different  
scheme).

Hope this helps,
Toon.



More information about the Gcc-bugs mailing list