netcdf-3.5.0 WIN32_README 09/04/2001 JCaron 1. Using pre-built binaries 2. Building the libraries 3. Macros needed for using Visual Studio 4. Testing messages that you can ignore ************************************************************************* 1. Using pre-built binaries We have pre-built Win32 binary versions of the netcdf dll and static library, as well as ncgen.exe and ncdump.exe (dll and static versions). You can get them from ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-3.5.0.win32bin.zip. (Note: we dont have a C++ interface here). To use: 1. Place these in your include directory: netcdf.h C include file netcdf.inc Fortran include file 2a. To use the Dynamic Library (shared) version of the netcdf library: Place these in a directory that's in your PATH: netcdf.dll library dll ncgen.exe uses the dll ncdump.exe uses the dll Place this in a library directory to link against: netcdf.lib library 2b. Alternatively, to use a static version of the library Place this in a library directory to link against: netcdfs.lib library Place these in a directory that's in your PATH: ncgens.exe statically linked (no DLL needed) ncdumps.exe statically linked (no DLL needed) ******************************************************************************** 2. Building the libraries To build the library yourself, get the file ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-3.5.0.win32make.VC6.zip The makefiles there describe how to build netcdf-3.5 using the using Microsoft Visual C++ 6.x and (optionally) Digital Visual Fortran 6.x. Because of difficulties in getting Microsoft Visual Studio to fall in line with our existing source directory scheme, we chose _not_ to build the system "inside" Visual Studio. Instead, we provide a simple group of "msoft.mak" files which can be used. If you wish to work in Visual Studio, go ahead. Read the section called "Macros" at the end of this discussion. As of this writing, we have not tried compiling the C++ interface in this environment. To build netcdf, proceed as follows: 1) Get the netcdf source distribution and unpack it somewhere. 2) Copy netcdf-3.5.0.win32make.VC6.zip into the netcdf-3.5.0/src directory, and unzip it from there. 3) Read WIN32_INSTALL.txt (this file). If you want to make the static library version, read section 2.1 now. 4) In src\libsrc; nmake /f msoft.mak This will build netcdf.lib and netcdf.dll Note: This makefiles make DLLs. To make static libraries see section on static libraries. 5) (optional) In src\libsrc; nmake /f msoft.mak test This will make and run the simple test. 6) (optional) In src\fortran; nmake /f msoft.mak This will build the fortran interface and rebuild dll in ..\libsrc to include the fortran interface. Note Bene: We don't provide a .DEF file, so this step changes the "ordinals" by which entry points in the DLL found. Some sites may wish to modify the msoft.mak file(s) to produce a separate library for the fortran interface. 7) (necessary if you want to use fortran code) While you are in src\fortran; nmake /f msoft.mak test This tests the netcdf-2 fortran interface. 8) (optional, but recommended) In src\nctest; nmake /f msoft.mak test This tests the netcdf-2 C interface. 9) (optional, but highly recommended) In src\nc_test; nmake /f msoft.mak test This tortures the netcdf-3 C interface. 10) (optional, but highly recommended if you built the fortran interface) In src\nf_test; nmake /f msoft.mak test This tortures the netcdf-3 fortran interface. 11) (optional) In src\ncdump; nmake /f msoft.mak This makes ncdump.exe. 12) (optional) In src\ncgen; nmake /f msoft.mak This makes ncgen.exe. 13) (optional) In src\ncdump; nmake /f msoft.mak test This tests ncdump. Both ncgen and ncdump need to be built prior to this test. Note the makefile sets the path so that ..\libsrc\netcdf.dll can be located. 14) (optional) In src\ncgen; nmake /f msoft.mak test This tests ncgen. Both ncgen and ncdump need to be built prior to this test. Note the makefile sets the path so that ..\libsrc\netcdf.dll can be located. 15) Install: Copy libsrc\netcdf.lib to a LIBRARY directory. Copy libsrc\netcdf.h and fortran/netcdf.inc to an INCLUDE directory. Copy libsrc\netcdf.dll, ncdump/ncdump.exe, and ncgen/ncgen.exe to a BIN directory (someplace in your PATH). 2.1 Static Libraries: There are make files called "msofts.mak" that create and use a static version of the netcdf library, named "netcdfs.lib". If you use these makefiles, ncgen and ncdump will be statically linked. DLLs are shared, so are more efficient, but you must be sure that they can be found in your PATH. To make the static library versions, repeat all steps above except use "msofts.mak" instead of "msoft.mak" (if you already made the dll version, be sure to do a "make clean" before running the msofts.mak). The library will be named netcdfs.lib, and the bins will be named ncgen.exe and ncdump.exe. Rename them if you want both the static and dll versions. ************************************************************************* 3.0 Macros (for Visual Studio or other IDE). Generally you should look at the msoft.mak files and duplicate the macros defined there: Always define NDEBUG to turn off our assertions. libsrc\netcdf.h: Define DLL_NETCDF whenever the netcdf library is a DLL. Also define DLL_EXPORT when you are building the library itself. fortran\ Set defines thus /D "DLL_EXPORT" /D FCALLSC_QUALIFIER="__declspec(dllexport) __stdcall" if you building the fortran interfaces to put in a DLL. fortran\ and nf_test\: Define VISUAL_CPLUSPLUS so cfortran.h and nf_test.F know what to do.