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.
Hi Willie, > I am using a computer in which the netcdf library has aleady been > built. How do I find out whether it is a 64 bit library or a 32 bit > library (I am not talking about whether 64 bit offsets are used in the > data file)? My application can be built on 32 bit or 64 bit machines, > but I obviously need to align this with the existing library, so I don't > get run time parameter mismatches. If you're using a Unix system, the "file" command can tells you for a shared library, as in: $ file /usr/local/lib/libnetcdf.so.7.2.0 /usr/local/lib/libnetcdf.so.7.2.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped which indicates a 64-bit library. For a static library archive, such as libnetcdf.a, that doesn't work: $ file /usr/local/lib/libnetcdf.a /usr/local/lib/libnetcdf.a: current ar archive but you can still find out by extracting a member of the library and using "file" on that. For example: $ ar t /usr/local/lib/libnetcdf.a | head -3 libnetcdf_la-stub.o libnetcdf2_la-dv2i.o libdispatch_la-datt.o tells you the first 3 members of the archive, and if you just pick one and pipe it into the file command, voila: $ ar -p /usr/local/lib/libnetcdf.a libnetcdf_la-stub.o | file - /dev/stdin: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped telling you it's a 64-bit object. > A secondary question: is it possible to have both types of library of > the same machine Yes, for some Unix systems. For example MacOS-X supports creating so-called "Universal" libraries that have 32-bit and 64-bit objects in the same library. I don't think that's possible on Linux systems, and I'm not sure about other platforms. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: OUJ-228033 Department: Support netCDF Priority: Normal Status: Closed