This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> End, > > I have certainly tasted madness. I have spent several days trying to > understand ncfortran.h mostly to no avail. > > You ask: > You want to calculate with 64-bit integers, but write 32-bit integers? > > > The answer is no. The application calling the library needs to use 64-bit > integers. Therefore when using a Fortran interface to a library function > any mention of an integer in the function call prototype will cause a > 64-bit value to be passed at runtime. I assumed that if I built the netCDF > libraries in a 64-bit data environment (Fortran -qintsize=8) then this > should work. OK, but netcdf is about storage, so what is it you want to store? 32-bit or 64 bit values? I notice from rereading your emails that you said the f77 tests. You could build with --disable-f90 and just use the f77 API, if it works. It's almost as simple as the F90 API. But I am having a hard time wrapping my head around this problem. Is what you are doing even legal for netcdf? You want to write a 64-bit integer, but you want to call it a NF_INT? That is not correct. The correct answer would be to change the code to explicitly use 8-byte integers in the code, correct? Can't f90 do that with the "kind" keyword? OK, but it is not a perfect world. Perhaps what you need to do is get netcdf-4, which has native handling of 64-bit integer (with the NC_INT64 and NC_UINT64 types). But you would still have a problem that if you tried to hand netcdf an integer you are giving it 64-bits and the library is expecting 32-bits. Perhaps the answer is to build netcdf-4 as a 32-bit integer application and then call it from your application, writhing NC_INT64s, and handing it your data. I need to discuss this with my colleague Russ about this... Ed Ticket Details =================== Ticket ID: DKO-246585 Department: Support netCDF Priority: Normal Status: Open