Fix Windows linker errors and warnings. (#166)
authorDreamer <dreamer.dead@gmail.com>
Wed, 3 Aug 2016 07:25:38 +0000 (10:25 +0300)
committerAndreas Schuh <andreas.schuh.84@gmail.com>
Wed, 3 Aug 2016 07:25:38 +0000 (08:25 +0100)
src/gflags.cc
src/gflags_declare.h.in

index bbd58ec..3464b3f 100644 (file)
@@ -96,6 +96,7 @@
 #if defined(HAVE_FNMATCH_H)
 #  include <fnmatch.h>
 #elif defined(HAVE_SHLWAPI_H)
+#  define NO_SHLWAPI_ISOS
 #  include <shlwapi.h>
 #endif
 #include <stdarg.h> // For va_list and related operations
@@ -1467,7 +1468,7 @@ FlagRegisterer::FlagRegisterer(const char* name,
 
 // Force compiler to generate code for the given template specialization.
 #define INSTANTIATE_FLAG_REGISTERER_CTOR(type)                  \
-  template FlagRegisterer::FlagRegisterer(                      \
+  template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer(      \
       const char* name, const char* help, const char* filename, \
       type* current_storage, type* defvalue_storage)
 
index a8b76f7..5e01198 100644 (file)
@@ -56,7 +56,7 @@
 
 // We always want to import variables declared in user code
 #ifndef GFLAGS_DLL_DECLARE_FLAG
-#  ifdef _MSC_VER
+#  if @GFLAGS_IS_A_DLL@ && defined(_MSC_VER)
 #    define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
 #  else
 #    define GFLAGS_DLL_DECLARE_FLAG