[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 970708: NC_SHORT error on WIN32 or NT?



> Hello,
>
> I've problems using the WIN32 DLL with NC_SHORT types.
> Each time I write or read shorts, an specific other value is recieved.
> Example:
> write 0.s recieve 0.s thats O.K.
> write 1.s recieve 256.s
> write 19.s recieve 4864.s
> write 23.s recieve 5888.s
> write 1996.s recieve 13305.s
> and so on.
> For all other types the library works fine.
>
> I don't now if its an error of my own, an error in the
> NetCDF source, an compiler mistake or sommewhat of NT 4.0.
>
> I used the distributet WIN32 DLL of UCAR and compiled a debug DLL
> version with the MSVC++ 4.2 of my own with equal results.
>
> My system:
> Workstation:  DEC 200i (Pentium Pro 200)
> Sytem:                WinNT 4.0 Workstation,
> Compiler:     Microsoft Visuall C++ 4.2
>
> Definition in NCCONFIG.H:
> /* The number of bytes in a short.  */
> #define SIZEOF_SHORT 2
>
> Thanks
> Hartmut Freihofer

Hartmut:

You do not mention which version of the source code you are using.
If you are building from source, you may find
ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/maks.zip
helpful. (These should work with MSC 4.2 as well as the claimed 5.0)

We explictly test for the sort of problem you report in libsrc/t_nc,
nctest/nctest, and nc_test/nc_test, so I'm pretty sure that the library
works as it should.

You can compile and run these tests against your versions of the library
to be sure. Start with libsrc/t_nc. If these fail, let me know.
Otherwise, looking at the output you have, I'd guess there is an off by
one byte error in your conversion between of void * addresses and short *.

-glenn