netcdf-c/ncdump/tst_hdf5_offset.sh
Dennis Heimbigner c68c4c804d Fix undefined references when using Visual Studio
Fix Issue https://github.com/Unidata/netcdf-c/issues/1725.
Replace PR https://github.com/Unidata/netcdf-c/pull/1726
Also replace PR https://github.com/Unidata/netcdf-c/pull/1694

The general problem is that under Visual Studio, we are seeing
a number of undefined reference and other scoping errors.
The reason is that the code is not properly using Visual Studio
_declspec() declarations.

The basic solution is to ensure that when compiling the code itself
one needs to ensure that _declspec(dllexport) is used. There
are several sets of macros to handle this, but they all rely
on the flag DLL_EXPORT being define when the code is compiled,
but not being defined when the code is used via a .h file.

As a test, I modified XGetOpt.c to build properly. I also
fixed the oc2 library to properly _declspec things like ocdebug.

I also made some misc. changes to get all the tests to run
if cygwin is installed (to get bash, sed, etc).

Misc. Changes:
* Put XGetOpt.c into libsrc and copy at build time
  to the other directories where it is needed.
2020-05-18 19:36:28 -06:00

46 lines
933 B
Bash
Executable File

#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
set -e
# This tests that we can detect an HDF5 file with an offset
rm -f ./offset.cdl ./offset.nc
cp ${srcdir}/small.cdl ./offset.cdl
${NCGEN} -4 ./offset.cdl
# Test a 512 byte offset
rm -f L512.hdf5
# verify size of L512.bin
#LSIZE=`wc -c ${srcdir}/L512.bin | cut -d ' ' -f 1`
cat ${srcdir}/L512.bin offset.nc > L512.hdf5
K=`${NCDUMP} -k L512.hdf5 | tr -d '\r'`
if test "x$K" = "xnetCDF-4" ; then
echo "***Pass: 512 offset"
else
echo "***FAIL: 512 offset"
FAILURES=1
fi
# Test a 1024 byte offset
rm -f L1024.hdf5
cat ${srcdir}/L512.bin ${srcdir}/L512.bin offset.nc > L1024.hdf5
K=`${NCDUMP} -k L1024.hdf5 | tr -d '\r'`
if test "x$K" = "xnetCDF-4" ; then
echo "***Pass: 1024 offset"
else
echo "***FAIL: 1024 offset"
FAILURES=1
fi
#cleanup
rm -f L512.hdf5 L1024.hdf5
rm -f ./offset.cdl ./offset.nc
if test "x$FAILURES" = x1 ; then
exit 1
fi
exit 0