#include "mutex.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.
DEFINE_string(flagfile, "", "load flags from file");
assert(false);
return "";
}
- // Directly indexing the strigns in the 'types' string, each of them
- // is 7 bytes long.
+ // Directly indexing the strings in the 'types' string, each of them is 7 bytes long.
return &types[type_ * 7];
}
# endif
#endif
-// We always want to export defined variables, dll or no
-#if defined(_MSC_VER)
-# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport)
-#else
-# define GFLAGS_DLL_DEFINE_FLAG
+// By default, we always want to export defined variables, assuming
+// 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)
+# else
+# define GFLAGS_DLL_DEFINE_FLAG
+# endif
#endif
-// We always want to import declared variables, dll or no
-#if defined(_MSC_VER)
-# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
-#else
-# define GFLAGS_DLL_DECLARE_FLAG
+// By default, we always want to export defined variables, assuming
+// 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)
+# else
+# define GFLAGS_DLL_DECLARE_FLAG
+# endif
#endif
// Export/import of STL class instantiations
#include "config_for_unittests.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 <stdio.h>
#include <stdlib.h>