[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Support #PQG-365496]: netcdf and CCSM



> Hi Ed,
> 
> Thanks for this technical answer.
> 
> I have a few more questions.
> 
> 1. When you say "the netCDF configure script looks at your fortran
> compiler when netCDF is built"  is the fortran compiler specified in the
> netcdf build explicitly by the person who is building netcdf?  If not, how
> does the netcdf build figure out which fortran compiler you intend to use?

Correct! The user must specify it (with the FC environment variable), or else 
the configure script looks around for a compiler, and, if it can't find one, 
gives up.

> 
> 2. You said "If you then try to use a different fortran compiler on your
> application,the Fortran -> C layer will be wrong. When you try and link,
> the linker will report that a bunch of netCDF functions are missing,
> because it can't find them in the netCDF library."  Are these missing
> routines the ones that do things like convert fortran strings to c
> strings, and convert fortan's pass-by-address parameters to c's
> pass-by-value parameters?

No, actually it will show a bunch of netCDF functions as missing. The reason is 
that the names of the functions themselves are where the magic takes place. The 
Fortran -> C layer is a set of C macros that comes up with the correct name for 
the C function, if it were to be called from the fortran compiler. Usually this 
involves some monkeying around with underscore characters in the function name.

If you use a different Fortran compiler, the underscores will be wrong (as far 
as your netCDF library is concerned) and it will tell you that it can't find 
the netcdf functions.

(And there are *also* a few routines that convert various argument issues, 
including the fact that in fortran everything is numbered starting with 1, but 
in C with a 0, and the fact that the dimensions in C and Fortran are stored in 
opposite order in the dimids list for defining a variable.)

Ed



Ticket Details
===================
Ticket ID: PQG-365496
Department: Support netCDF
Priority: Normal
Status: Closed