Re: G95: just say no to second underscore

Mark Hadfield <m.hadfield@xxxxxxxxxx> writes:

>> 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 certainly understand your point, but I think that, by default, I
should not use the -fno-second-underscore with g95.

The goal is that, once netcdf is built for your fortran compiler, you
should not need any special flags to compile a netCDF fortran program.

If I set the flags as you suggest for the netCDF build, then the user
would have to know to set them when compiling any fortran netCDF
program. This would generate a lot of support questions from people
who built the netCDF fortran library, but couldn't get a fortran
program to correctly compile, because they didn't know to set the
flags.

So I am going to leave things as they are, and let g95 users who want
to work with other packages set the flags as they wish. If you set
these flags before building netCDF, it will not try to override your
choices, so knowledgeable users can use the no-second-underscore flag
if they wish.

I have added the following note to the Porting and Installation Guide:

"GNU compilers, and the g95 fortran compiler, use the f2cFortran
flag. This is turned on automatically by configure.

Some g95 users recommend instead setting the following, which handles
the underscores differently, and reportedly works better when
integrating with other packages or libraries:

@example
CC=gcc
FC=g95
CPPFLAGS=-DpgiFortran
FFLAGS=-fno-second-underscore
FCFLAGS=-fno-second-underscore
@end example

If this approach is taken, all fortran programs which use netCDF must
be compiled with the -fno-second-underscore flag."

Thanks,

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

==============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


  • 2007 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: