mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
c68c4c804d
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.
41 lines
921 B
C
41 lines
921 B
C
// XGetopt.h Version 1.2
|
|
//
|
|
// Author: Hans Dietrich
|
|
// hdietrich2@hotmail.com
|
|
//
|
|
// This software is released into the public domain.
|
|
// You are free to use it in any way you like.
|
|
//
|
|
// This software is provided "as is" with no expressed
|
|
// or implied warranty. I accept no liability for any
|
|
// damage or loss of business that this software may cause.
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
#ifndef XGETOPT_H
|
|
#define XGETOPT_H
|
|
|
|
#include <windows.h>
|
|
#include <stdio.h>
|
|
#include <tchar.h>
|
|
|
|
#if 0
|
|
#ifdef _MSC_VER
|
|
# ifdef DLL_EXPORT
|
|
# define GTOPT_EXTRA __declspec(dllexport)
|
|
# else
|
|
# define GTOPT_EXTRA __declspec(dllimport)
|
|
# endif
|
|
#else
|
|
# define GTOP_EXTRA
|
|
#endif
|
|
#endif
|
|
|
|
#define GTOPT_EXTRA
|
|
GTOPT_EXTRA extern int optind, opterr;
|
|
GTOPT_EXTRA extern TCHAR* optarg;
|
|
GTOPT_EXTRA extern int getopt(int argc, TCHAR *argv[], TCHAR *optstring);
|
|
|
|
#endif //XGETOPT_H
|