Re: G95: just say no to second underscore

Ed Hartnett wrote:
Howdy Mark!

I am responding to your email rather late, because I just got g95 up
and running in the netCDF nightly build system.

I have cut out a lot of quoted text here, but basically my original message described how to build netCDF with g95 using the "-fno-second-underscore" convention. I also suggested making this the default...

Can you tell me what the consequences of this are?

Do g95 users have to use -fno-second-underscore when compiling a
fortran program with the netCDF library?
Yes, they would have to do this.
If I just set -Df2cFortran when compiling netCDF, g95 works without
any further fuss. What is wrong with doing that?
Only that g95's default "second-underscore" name mangling complicates building other packages, e.g. the MITgcm ocean model, and you can't mix libraries that use different name mangling conventions. (The same is true of g77.) This can be worked around in each case, of course, but personally I think it's simpler to use "-fno-second-underscore" everywhere.
I have just added g95 to a number of our nightly test platforms. The
intention is to have netCDF 3.6.2 do the "right thing" for g95. Now I
just have to know what the right thing is!
Hmmm. My original message to the group didn't bring a deluge of "I agree" responses, so perhaps you should stick with the default.

My next suggestion was that the test in the configure code for Fortran-C linking could use a subroutine name with an underscore (given that the f2c name-mangling convention behaves differently for names with and without underscores, and all the names in the netCDF-3 Fortran interface have underscores).

At the moment configure automatically sets -Df2cFortran for g95, and
everything seems to work. What's wrong with that?
Well, when you say "automatically" you mean that it works OK because of a lot of special-case code. Just like all the other packages that cope with g77's and g95's perverse name mangling.

But, I guess the sensible approach for you to take is "if it ain't broke don't fix it".

Mark Hadfield          "Ka puwaha te tai nei, Hoea tahi tatou"
National Institute for Water and Atmospheric Research (NIWA)

To unsubscribe netcdfgroup, visit: