Commit 10768125 authored by Andreas Schuh's avatar Andreas Schuh

Fix VS linker warning regarding locally defined FLAGS_tryfromenv symbol.

parent 8d3797cd
...@@ -109,6 +109,11 @@ ...@@ -109,6 +109,11 @@
#include "mutex.h" #include "mutex.h"
#include "util.h" #include "util.h"
// Export the following flags only if the gflags library is a DLL
#ifndef GFLAGS_SHARED_LIBS
# undef GFLAGS_DLL_DEFINE_FLAG
# define GFLAGS_DLL_DEFINE_FLAG
#endif
// Special flags, type 1: the 'recursive' flags. They set another flag's val. // Special flags, type 1: the 'recursive' flags. They set another flag's val.
DEFINE_string(flagfile, "", "load flags from file"); DEFINE_string(flagfile, "", "load flags from file");
...@@ -395,8 +400,7 @@ const char* FlagValue::TypeName() const { ...@@ -395,8 +400,7 @@ const char* FlagValue::TypeName() const {
assert(false); assert(false);
return ""; return "";
} }
// Directly indexing the strigns in the 'types' string, each of them // Directly indexing the strings in the 'types' string, each of them is 7 bytes long.
// is 7 bytes long.
return &types[type_ * 7]; return &types[type_ * 7];
} }
......
...@@ -72,18 +72,24 @@ ...@@ -72,18 +72,24 @@
# endif # endif
#endif #endif
// We always want to export defined variables, dll or no // By default, we always want to export defined variables, assuming
#if defined(_MSC_VER) // that the DEFINE_FLAG macros are used within shared modules.
#ifndef GFLAGS_DLL_DEFINE_FLAG
# if defined(_MSC_VER)
# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport) # define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport)
#else # else
# define GFLAGS_DLL_DEFINE_FLAG # define GFLAGS_DLL_DEFINE_FLAG
# endif
#endif #endif
// We always want to import declared variables, dll or no // By default, we always want to export defined variables, assuming
#if defined(_MSC_VER) // that the DECLARE_FLAG macros are used within shared modules.
#ifndef GFLAGS_DLL_DECLARE_FLAG
# if defined(_MSC_VER)
# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport) # define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
#else # else
# define GFLAGS_DLL_DECLARE_FLAG # define GFLAGS_DLL_DECLARE_FLAG
# endif
#endif #endif
// Export/import of STL class instantiations // Export/import of STL class instantiations
......
...@@ -35,6 +35,11 @@ ...@@ -35,6 +35,11 @@
#include "config_for_unittests.h" #include "config_for_unittests.h"
#include <gflags/gflags.h> #include <gflags/gflags.h>
#ifndef GFLAGS_SHARED_LIBS
# undef GFLAGS_DLL_DECLARE_FLAG
# define GFLAGS_DLL_DECLARE_FLAG
#endif
#include <math.h> // for isinf() and isnan() #include <math.h> // for isinf() and isnan()
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment