This might more properly be filed as a bug report, but ...
I came upon the following problem while trying to dyn.load a library
of Fortran code into R. I'm running RedHat 7.1 on a Pentium III
laptop, with R version 1.3.1 (latest rpm from CRAN) and gcc/g77
version 2.96.
My library has a number of Fortran subroutines that have underscores
in their names for readability. By default g77 appends TWO
underscores to the ends of Fortran names that contain an underscore.
According to the g77 documentation this is for compatibility with f2c
and "many other UNIX Fortran compilers". Unfortunately these symbols
are not in turn found by R, which expects only a single underscore in
all cases.
I can think of three obvious solutions to this problem:
1. I could edit all my code and take the underscores out of the
names.
I definitely don't want to do this.
2. Add -fno-second-underscore to FFLAGS in ${R_HOME}/etc/Makeconf.
This seems to work for me, though I'm concerned that it might
break something else down the line. In general, I suppose that
this could be done in configure, though I don't know which other
compilers have this feature, or what switches they might use to
turn off it off.
3. Change symbol.For, .Fortran, dyn.load, and whatever else to
produce/look for the correct names.
This seems like the "right" answer, though it would presumably
require some work in configure and elsewhere. I notice that there
is already some underscore checking going on in configure and in
places like Rdynload.c.
Any suggestions are welcome. Am I missing anything?