Issue #73 Fix missing STL DLL export warnings of Visual Studio according to KB168958.
authorAndreas Schuh <andreas.schuh.84@gmail.com>
Fri, 14 Mar 2014 16:08:52 +0000 (16:08 +0000)
committerAndreas Schuh <andreas.schuh.84@gmail.com>
Fri, 14 Mar 2014 16:08:52 +0000 (16:08 +0000)
src/gflags.h.in
src/gflags_config.h.in

index f68f7ab..6ca0a4b 100644 (file)
 #include "gflags_declare.h" // IWYU pragma: export
 
 
+// Export/import STL instantiations used as data members of exported classes
+// \sa http://support.microsoft.com/default.aspx?scid=KB;EN-US;168958
+#ifdef GFLAGS_EXTERN_STL
+  GFLAGS_EXTERN_STL template class GFLAGS_DLL_DECL std::allocator<char>;
+  GFLAGS_EXTERN_STL template class GFLAGS_DLL_DECL std::basic_string<char>;
+#endif
+
+
 namespace GFLAGS_NAMESPACE {
 
 
index df9b58b..6fa1289 100644 (file)
 #  define GFLAGS_DLL_DEFINE_FLAG
 #endif
 
+// Export/import of STL class instantiations
+// \sa http://support.microsoft.com/default.aspx?scid=KB;EN-US;168958
+#if defined(GFLAGS_SHARED_LIBS) && defined(_MSC_VER) && _MSC_VER >= 1100
+#  ifdef GFLAGS_DLL_EXPORT
+#    define GFLAGS_EXTERN_STL
+#  else
+#    define GFLAGS_EXTERN_STL extern
+#  endif
+#endif
+
 
 #endif // GFLAGS_GFLAGS_CONFIG_H_
\ No newline at end of file