Next: , Previous: Getting Prebuilt DLL, Up: Windows


4.2 Installing the DLL

Whether you get the pre-built DLL or build your own, you'll then have to install it somewhere so that your other programs can find it and use it.

To install a DLL, you just have to leave it in some directory, and (possibly) tell your compiler in which directory to look for it.

A DLL is a library, and functions just like libraries under the Unix operating system. As with any library, the point of the netCDF DLL is to provide functions that you can call from your own code. When you compile that code, the linker needs to be able to find the library, and then it pulls out the functions that it needs. In the Unix world, the -L option tells the compiler where to look for a library. In Windows, library search directories can be added to the project's property dialog.

Similarly, you will need to put the header file, netcdf.h, somewhere that you compiler can find it. In the Unix world, the -I option tells the compiler to look in a certain directory to find header files. In the Windows world, you set this in the project properties dialog box of your integrated development environment.

Therefore, installing the library means nothing more than copying the DLL somewhere that your compiler can find it, and telling the compiler where to look for them.

The standard place to put DLLs is Windows\System32 folder (for Windows2000/XP) or the Windows\System folder (for Windows 98/ME). If you put the DLL there, along with the ncgen and ncdump executables, you will be able to use the DLL and utilities without further work, because compilers already look there for DLLs and EXEs.

Instead of putting the DLL and EXEs into the system directory, you can leave them wherever you want, and every development project that uses the dll will have to be told to search the netCDF directory when it's linking, or, the chosen directory can be added to your path.

On the .NET platform, you can also try to use the global assembly cache. (To learn how, see MSDN topic “Global Assembly Cache”, at www.msdn.microsoft.com).

Following Windows conventions, the netCDF files belong in the following places:

File(s) Description Location


netcdf.dll C and Fortran function in DLL Windows\System (98/ME) or Windows\System32 (2000/XP)


netcdf.lib Library file Windows\System (98/ME) or Windows\System32 (2000/XP)


ncgen.exe, ncdump.exe NetCDF utilities Windows\System (98/ME) or Windows\System32 (2000/XP)


netcdf-3 netCDF source code Program Files\Unidata