Re: [netcdfgroup] What is the "standard" way to use NetCDF from Fortran 90?

Dave Allured <dave.allured@xxxxxxxx> writes:

> Careful use of environment variables as input to user make files makes
> switching between compilers easy.  I use $F90_CMD and $LIB_NETCDF for
> this purpose, as well as a few others.  The second one contains the
> associated library path.  HTH.
>

I should mention here a new feature that will be part of the upcoming
4.1 release: the nc-config script that will be installed as a binary
when netCDF is installed. It returns the information needed by a Fortran
or C compiler to compile and link with netCDF code. 

For example, after installing netCDF in /machine/netcdf/n4_new2/in1, I
can run /machine/netcdf/n4_new2/in1/bin/nc-config and learn what command
line options I need to provide for the C and Fortran compilers:

bash-3.2$ ./nc-config --cflags
-I/machine/netcdf/n4_new2/in1/include

bash-3.2$ ./nc-config --libs
-L/machine/netcdf/n4_new2/in1/lib -lnetcdf -L/machine/local/lib -lhdf5_hl 
-lhdf5 -lz -lm

bash-3.2$ ./nc-config --flibs
-M/machine/netcdf/n4_new2/in1/lib -lnetcdf -L/machine/local/lib -lhdf5_hl 
-lhdf5 -lz -lm

The case above is quite simple - more complex installs can involve more
directories and libraries.

The nc-config feature was originally contributed by Arlindo DaSilva at
NASA/GSFC (thanks Arlindo!).

Thanks,

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx



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