[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #KIS-873279]: netCDF General - ncerr link error
- Subject: [netCDF #KIS-873279]: netCDF General - ncerr link error
- Date: Mon, 09 Jul 2007 08:37:11 -0600
> Institution: Stillwater Supercomputing, Inc.
> Package Version: 3.6.2 3.6.1 older
> Operating System: Win32
> Hardware Information: Intel core 2 duo
> Inquiry: I am stuck with a link error on ncerr. I get the same error on
> precompiled libs or when I build the netcdf lib myself. I have double checked
> with dumpbin that ncerr is defined in the lib and it is:
>
> Archive member name at 1183A: netcdf.dll/
> 46914E68 time/date Sun Jul 08 16:51:52 2007
> uid
> gid
> 0 mode
> 26 size
> correct header end
>
> Version : 0
> Machine : 14C (x86)
> TimeDateStamp: 46914E68 Sun Jul 08 16:51:52 2007
> SizeOfData : 00000012
> DLL name : netcdf.dll
> Symbol name : _ncerr
> Type : data
> Name type : no prefix
> Hint : 342
> Name : ncerr
>
> I can write working netcdf programs as long as I don't use ncerr or ncopts.
> At this point I don't know how to fix this. My larger goal is to use the
> Exodus II mesh library which uses netCDF and which is was the first code
> where I encountered this problem. I have been reading the netCDF
> documentation and source code and see the ncerr/ncopts variables in the code
> and in the binary but I can't seem to link to them.
>
> Any suggestions are welcome.
>
>
>
>
Are you building with the DLL_NETCDF environment flag set?
The two variables, ncerr and ncopts, are the only two global variables in the
netCDF API. They are left over from the netCDF-2 API, and are not necessary if
you are using the netCDF-3 API.
However, some code does use them, and there is something weird about how to
handle global variables under Windows. (Because there is always something weird
about doing *anything* under windows!)
The answer is going to be in how ncerr and ncopts are declared in
libsrc/netcdf.h.
/* Declaration modifiers for DLL support (MSC et al) */
#if defined(DLL_NETCDF) /* define when library is a DLL */
# if defined(NC_DLL_EXPORT) /* define when building the library */
# define MSC_EXTRA __declspec(dllexport)
# else
# define MSC_EXTRA __declspec(dllimport)
# endif
#include <io.h>
#define lseek _lseeki64
#define off_t __int64
#define stat __stat64
#define fstat _fstat64
#else
#define MSC_EXTRA
#endif /* defined(DLL_NETCDF) */
# define EXTERNL extern MSC_EXTRA
/* When netCDF is built as a DLL, this will export ncerr and
* ncopts. When it is used as a DLL, it will import them. */
#if defined(DLL_NETCDF)
MSC_EXTRA int ncerr;
MSC_EXTRA int ncopts;
#endif
Ticket Details
===================
Ticket ID: KIS-873279
Department: Support netCDF
Priority: Normal
Status: Open