aboutsummaryrefslogtreecommitdiffstats
path: root/include/gtest
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-03-05 21:21:06 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-03-05 21:21:06 +0000
commit83589cca345d2f03d93b0555437aa480e0ed6699 (patch)
treeaca5d19835a1562fd71e48e6ca289f33b0f68e30 /include/gtest
parent542b41e5d010cf0a18a37252d5f4b05cfa5408af (diff)
downloadgoogletest-83589cca345d2f03d93b0555437aa480e0ed6699.tar.gz
googletest-83589cca345d2f03d93b0555437aa480e0ed6699.tar.bz2
googletest-83589cca345d2f03d93b0555437aa480e0ed6699.zip
Supports building gtest as a DLL (by Vlad Losev).
Diffstat (limited to 'include/gtest')
-rw-r--r--include/gtest/gtest-death-test.h4
-rw-r--r--include/gtest/gtest-message.h2
-rw-r--r--include/gtest/gtest-spi.h4
-rw-r--r--include/gtest/gtest-test-part.h7
-rw-r--r--include/gtest/gtest.h102
-rw-r--r--include/gtest/internal/gtest-death-test-internal.h4
-rw-r--r--include/gtest/internal/gtest-internal.h39
-rw-r--r--include/gtest/internal/gtest-linked_ptr.h2
-rw-r--r--include/gtest/internal/gtest-param-util.h4
-rw-r--r--include/gtest/internal/gtest-port.h39
-rw-r--r--include/gtest/internal/gtest-string.h4
11 files changed, 118 insertions, 93 deletions
diff --git a/include/gtest/gtest-death-test.h b/include/gtest/gtest-death-test.h
index fdb497f4..121dc1fb 100644
--- a/include/gtest/gtest-death-test.h
+++ b/include/gtest/gtest-death-test.h
@@ -176,7 +176,7 @@ GTEST_DECLARE_string_(death_test_style);
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
// Tests that an exit code describes a normal exit with a given exit code.
-class ExitedWithCode {
+class GTEST_API_ ExitedWithCode {
public:
explicit ExitedWithCode(int exit_code);
bool operator()(int exit_status) const;
@@ -190,7 +190,7 @@ class ExitedWithCode {
#if !GTEST_OS_WINDOWS
// Tests that an exit code describes an exit due to termination by a
// given signal.
-class KilledBySignal {
+class GTEST_API_ KilledBySignal {
public:
explicit KilledBySignal(int signum);
bool operator()(int exit_status) const;
diff --git a/include/gtest/gtest-message.h b/include/gtest/gtest-message.h
index 711ef2f4..f135b694 100644
--- a/include/gtest/gtest-message.h
+++ b/include/gtest/gtest-message.h
@@ -79,7 +79,7 @@ namespace testing {
// latter (it causes an access violation if you do). The Message
// class hides this difference by treating a NULL char pointer as
// "(null)".
-class Message {
+class GTEST_API_ Message {
private:
// The type of basic IO manipulators (endl, ends, and flush) for
// narrow streams.
diff --git a/include/gtest/gtest-spi.h b/include/gtest/gtest-spi.h
index 2953411b..c41da484 100644
--- a/include/gtest/gtest-spi.h
+++ b/include/gtest/gtest-spi.h
@@ -48,7 +48,7 @@ namespace testing {
// generated in the same thread that created this object or it can intercept
// all generated failures. The scope of this mock object can be controlled with
// the second argument to the two arguments constructor.
-class ScopedFakeTestPartResultReporter
+class GTEST_API_ ScopedFakeTestPartResultReporter
: public TestPartResultReporterInterface {
public:
// The two possible mocking modes of this object.
@@ -93,7 +93,7 @@ namespace internal {
// TestPartResultArray contains exactly one failure that has the given
// type and contains the given substring. If that's not the case, a
// non-fatal failure will be generated.
-class SingleFailureChecker {
+class GTEST_API_ SingleFailureChecker {
public:
// The constructor remembers the arguments.
SingleFailureChecker(const TestPartResultArray* results,
diff --git a/include/gtest/gtest-test-part.h b/include/gtest/gtest-test-part.h
index dd271602..f7147590 100644
--- a/include/gtest/gtest-test-part.h
+++ b/include/gtest/gtest-test-part.h
@@ -44,7 +44,7 @@ namespace testing {
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
//
// Don't inherit from TestPartResult as its destructor is not virtual.
-class TestPartResult {
+class GTEST_API_ TestPartResult {
public:
// The possible outcomes of a test part (i.e. an assertion or an
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
@@ -120,7 +120,7 @@ std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
//
// Don't inherit from TestPartResultArray as its destructor is not
// virtual.
-class TestPartResultArray {
+class GTEST_API_ TestPartResultArray {
public:
TestPartResultArray() {}
@@ -155,7 +155,8 @@ namespace internal {
// reported, it only delegates the reporting to the former result reporter.
// The original result reporter is restored in the destructor.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-class HasNewFatalFailureHelper : public TestPartResultReporterInterface {
+class GTEST_API_ HasNewFatalFailureHelper
+ : public TestPartResultReporterInterface {
public:
HasNewFatalFailureHelper();
virtual ~HasNewFatalFailureHelper();
diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h
index c6f82e74..446f0281 100644
--- a/include/gtest/gtest.h
+++ b/include/gtest/gtest.h
@@ -251,7 +251,7 @@ String StreamableToString(const T& streamable) {
// Expected: Foo() is even
// Actual: it's 5
//
-class AssertionResult {
+class GTEST_API_ AssertionResult {
public:
// Copy constructor.
// Used in EXPECT_TRUE/FALSE(assertion_result).
@@ -306,14 +306,14 @@ AssertionResult& AssertionResult::operator<<(const T& value) {
}
// Makes a successful assertion result.
-AssertionResult AssertionSuccess();
+GTEST_API_ AssertionResult AssertionSuccess();
// Makes a failed assertion result.
-AssertionResult AssertionFailure();
+GTEST_API_ AssertionResult AssertionFailure();
// Makes a failed assertion result with the given failure message.
// Deprecated; use AssertionFailure() << msg.
-AssertionResult AssertionFailure(const Message& msg);
+GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
// The abstract class that all tests inherit from.
//
@@ -338,7 +338,7 @@ AssertionResult AssertionFailure(const Message& msg);
// TEST_F(FooTest, Baz) { ... }
//
// Test is not copyable.
-class Test {
+class GTEST_API_ Test {
public:
friend class internal::TestInfoImpl;
@@ -486,7 +486,7 @@ class TestProperty {
// the Test.
//
// TestResult is not copyable.
-class TestResult {
+class GTEST_API_ TestResult {
public:
// Creates an empty TestResult.
TestResult();
@@ -604,7 +604,7 @@ class TestResult {
// The constructor of TestInfo registers itself with the UnitTest
// singleton such that the RUN_ALL_TESTS() macro knows which tests to
// run.
-class TestInfo {
+class GTEST_API_ TestInfo {
public:
// Destructs a TestInfo object. This function is not virtual, so
// don't inherit from TestInfo.
@@ -686,7 +686,7 @@ class TestInfo {
// A test case, which consists of a vector of TestInfos.
//
// TestCase is not copyable.
-class TestCase {
+class GTEST_API_ TestCase {
public:
// Creates a TestCase with the given name.
//
@@ -924,7 +924,7 @@ class EmptyTestEventListener : public TestEventListener {
};
// TestEventListeners lets users add listeners to track events in Google Test.
-class TestEventListeners {
+class GTEST_API_ TestEventListeners {
public:
TestEventListeners();
~TestEventListeners();
@@ -1011,7 +1011,7 @@ class TestEventListeners {
//
// This class is thread-safe as long as the methods are called
// according to their specification.
-class UnitTest {
+class GTEST_API_ UnitTest {
public:
// Gets the singleton UnitTest object. The first time this method
// is called, a UnitTest object is constructed and returned.
@@ -1198,34 +1198,34 @@ inline Environment* AddGlobalTestEnvironment(Environment* env) {
// updated.
//
// Calling the function for the second time has no user-visible effect.
-void InitGoogleTest(int* argc, char** argv);
+GTEST_API_ void InitGoogleTest(int* argc, char** argv);
// This overloaded version can be used in Windows programs compiled in
// UNICODE mode.
-void InitGoogleTest(int* argc, wchar_t** argv);
+GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
namespace internal {
// These overloaded versions handle ::std::string and ::std::wstring.
-inline String FormatForFailureMessage(const ::std::string& str) {
+GTEST_API_ inline String FormatForFailureMessage(const ::std::string& str) {
return (Message() << '"' << str << '"').GetString();
}
#if GTEST_HAS_STD_WSTRING
-inline String FormatForFailureMessage(const ::std::wstring& wstr) {
+GTEST_API_ inline String FormatForFailureMessage(const ::std::wstring& wstr) {
return (Message() << "L\"" << wstr << '"').GetString();
}
#endif // GTEST_HAS_STD_WSTRING
// These overloaded versions handle ::string and ::wstring.
#if GTEST_HAS_GLOBAL_STRING
-inline String FormatForFailureMessage(const ::string& str) {
+GTEST_API_ inline String FormatForFailureMessage(const ::string& str) {
return (Message() << '"' << str << '"').GetString();
}
#endif // GTEST_HAS_GLOBAL_STRING
#if GTEST_HAS_GLOBAL_WSTRING
-inline String FormatForFailureMessage(const ::wstring& wstr) {
+GTEST_API_ inline String FormatForFailureMessage(const ::wstring& wstr) {
return (Message() << "L\"" << wstr << '"').GetString();
}
#endif // GTEST_HAS_GLOBAL_WSTRING
@@ -1391,51 +1391,51 @@ GTEST_IMPL_CMP_HELPER_(GT, > )
// The helper function for {ASSERT|EXPECT}_STREQ.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
+ const char* actual_expression,
+ const char* expected,
+ const char* actual);
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
+GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
+ const char* actual_expression,
+ const char* expected,
+ const char* actual);
// The helper function for {ASSERT|EXPECT}_STRNE.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
+GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2);
// The helper function for {ASSERT|EXPECT}_STRCASENE.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
+GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2);
// Helper function for *_STREQ on wide strings.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual);
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
+ const char* actual_expression,
+ const wchar_t* expected,
+ const wchar_t* actual);
// Helper function for *_STRNE on wide strings.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2);
+GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
+ const char* s2_expression,
+ const wchar_t* s1,
+ const wchar_t* s2);
} // namespace internal
@@ -1513,16 +1513,16 @@ AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
// Helper function for implementing ASSERT_NEAR.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error);
+GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
+ const char* expr2,
+ const char* abs_error_expr,
+ double val1,
+ double val2,
+ double abs_error);
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// A class that enables one to stream messages to assertion macros
-class AssertHelper {
+class GTEST_API_ AssertHelper {
public:
// Constructor.
AssertHelper(TestPartResult::Type type,
@@ -1853,10 +1853,10 @@ const T* TestWithParam<T>::parameter_ = NULL;
// Asserts that val1 is less than, or almost equal to, val2. Fails
// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2);
-AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2);
+GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
+ float val1, float val2);
+GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
+ double val1, double val2);
#if GTEST_OS_WINDOWS
diff --git a/include/gtest/internal/gtest-death-test-internal.h b/include/gtest/internal/gtest-death-test-internal.h
index e98650e3..e4330848 100644
--- a/include/gtest/internal/gtest-death-test-internal.h
+++ b/include/gtest/internal/gtest-death-test-internal.h
@@ -64,7 +64,7 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
// by wait(2)
// exit code: The integer code passed to exit(3), _exit(2), or
// returned from main()
-class DeathTest {
+class GTEST_API_ DeathTest {
public:
// Create returns false if there was an error determining the
// appropriate action to take for the current death test; for example,
@@ -147,7 +147,7 @@ class DefaultDeathTestFactory : public DeathTestFactory {
// Returns true if exit_status describes a process that was terminated
// by a signal, or exited normally with a nonzero exit code.
-bool ExitedUnsuccessfully(int exit_status);
+GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
// ASSERT_EXIT*, and EXPECT_EXIT*.
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h
index a7858f9a..7bc35e20 100644
--- a/include/gtest/internal/gtest-internal.h
+++ b/include/gtest/internal/gtest-internal.h
@@ -161,7 +161,7 @@ String AppendUserMessage(const String& gtest_msg,
const Message& user_msg);
// A helper class for creating scoped traces in user programs.
-class ScopedTrace {
+class GTEST_API_ ScopedTrace {
public:
// The c'tor pushes the given source file location and message onto
// a trace stack maintained by Google Test.
@@ -240,8 +240,8 @@ inline String FormatForFailureMessage(T* pointer) {
#endif // GTEST_NEEDS_IS_POINTER_
// These overloaded versions handle narrow and wide characters.
-String FormatForFailureMessage(char ch);
-String FormatForFailureMessage(wchar_t wchar);
+GTEST_API_ String FormatForFailureMessage(char ch);
+GTEST_API_ String FormatForFailureMessage(wchar_t wchar);
// When this operand is a const char* or char*, and the other operand
// is a ::std::string or ::string, we print this operand as a C string
@@ -287,17 +287,18 @@ GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
// The ignoring_case parameter is true iff the assertion is a
// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
// be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const String& expected_value,
- const String& actual_value,
- bool ignoring_case);
+GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
+ const char* actual_expression,
+ const String& expected_value,
+ const String& actual_value,
+ bool ignoring_case);
// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-String GetBoolAssertionFailureMessage(const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value);
+GTEST_API_ String GetBoolAssertionFailureMessage(
+ const AssertionResult& assertion_result,
+ const char* expression_text,
+ const char* actual_predicate_value,
+ const char* expected_predicate_value);
// This template class represents an IEEE floating-point number
// (either single-precision or double-precision, depending on the
@@ -517,7 +518,7 @@ TypeId GetTypeId() {
// ::testing::Test, as the latter may give the wrong result due to a
// suspected linker bug when compiling Google Test as a Mac OS X
// framework.
-TypeId GetTestTypeId();
+GTEST_API_ TypeId GetTestTypeId();
// Defines the abstract factory interface that creates instances
// of a Test object.
@@ -550,8 +551,10 @@ class TestFactoryImpl : public TestFactoryBase {
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
// We pass a long instead of HRESULT to avoid causing an
// include dependency for the HRESULT type.
-AssertionResult IsHRESULTSuccess(const char* expr, long hr); // NOLINT
-AssertionResult IsHRESULTFailure(const char* expr, long hr); // NOLINT
+GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
+ long hr); // NOLINT
+GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
+ long hr); // NOLINT
#endif // GTEST_OS_WINDOWS
@@ -590,7 +593,7 @@ typedef void (*TearDownTestCaseFunc)();
// factory: pointer to the factory that creates a test object.
// The newly created TestInfo instance will assume
// ownership of the factory object.
-TestInfo* MakeAndRegisterTestInfo(
+GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
const char* test_case_name, const char* name,
const char* test_case_comment, const char* comment,
TypeId fixture_class_id,
@@ -606,7 +609,7 @@ bool SkipPrefix(const char* prefix, const char** pstr);
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// State of the definition of a type-parameterized test case.
-class TypedTestCasePState {
+class GTEST_API_ TypedTestCasePState {
public:
TypedTestCasePState() : registered_(false) {}
@@ -753,7 +756,7 @@ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, int skip_count);
// condition.
// Always returns true.
-bool AlwaysTrue();
+GTEST_API_ bool AlwaysTrue();
// Always returns false.
inline bool AlwaysFalse() { return !AlwaysTrue(); }
diff --git a/include/gtest/internal/gtest-linked_ptr.h b/include/gtest/internal/gtest-linked_ptr.h
index 5304bcc2..540ef4cd 100644
--- a/include/gtest/internal/gtest-linked_ptr.h
+++ b/include/gtest/internal/gtest-linked_ptr.h
@@ -77,7 +77,7 @@ namespace testing {
namespace internal {
// Protects copying of all linked_ptr objects.
-GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
+GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
// This is used internally by all instances of linked_ptr<>. It needs to be
// a non-template class because different types of linked_ptr<> can refer to
diff --git a/include/gtest/internal/gtest-param-util.h b/include/gtest/internal/gtest-param-util.h
index 8dec8532..546a6ea6 100644
--- a/include/gtest/internal/gtest-param-util.h
+++ b/include/gtest/internal/gtest-param-util.h
@@ -60,8 +60,8 @@ namespace internal {
// fixture class for the same test case. This may happen when
// TEST_P macro is used to define two tests with the same name
// but in different namespaces.
-void ReportInvalidTestCaseType(const char* test_case_name,
- const char* file, int line);
+GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
+ const char* file, int line);
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 4cf9663b..0a372f66 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -66,6 +66,13 @@
// Test's own tr1 tuple implementation should be
// used. Unused when the user sets
// GTEST_HAS_TR1_TUPLE to 0.
+// GTEST_LINKED_AS_SHARED_LIBRARY
+// - Define to 1 when compiling tests that use
+// Google Test as a shared library (known as
+// DLL on Windows).
+// GTEST_CREATE_SHARED_LIBRARY
+// - Define to 1 when compiling Google Test itself
+// as a shared library.
// This header defines the following utilities:
//
@@ -558,6 +565,20 @@
#endif // GTEST_HAS_SEH
+#ifdef _MSC_VER
+
+#if GTEST_LINKED_AS_SHARED_LIBRARY
+#define GTEST_API_ __declspec(dllimport)
+#elif GTEST_CREATE_SHARED_LIBRARY
+#define GTEST_API_ __declspec(dllexport)
+#endif
+
+#endif // _MSC_VER
+
+#ifndef GTEST_API_
+#define GTEST_API_
+#endif
+
namespace testing {
class Message;
@@ -570,7 +591,7 @@ typedef ::std::stringstream StrStream;
// A helper for suppressing warnings on constant condition. It just
// returns 'condition'.
-bool IsTrue(bool condition);
+GTEST_API_ bool IsTrue(bool condition);
// Defines scoped_ptr.
@@ -612,7 +633,7 @@ class scoped_ptr {
// A simple C++ wrapper for <regex.h>. It uses the POSIX Enxtended
// Regular Expression syntax.
-class RE {
+class GTEST_API_ RE {
public:
// Constructs an RE from a string.
RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
@@ -688,7 +709,7 @@ enum GTestLogSeverity {
// Formats log entry severity, provides a stream object for streaming the
// log message, and terminates the message with a newline when going out of
// scope.
-class GTestLog {
+class GTEST_API_ GTestLog {
public:
GTestLog(GTestLogSeverity severity, const char* file, int line);
@@ -1330,19 +1351,19 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
#define GTEST_FLAG(name) FLAGS_gtest_##name
// Macros for declaring flags.
-#define GTEST_DECLARE_bool_(name) extern bool GTEST_FLAG(name)
+#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
#define GTEST_DECLARE_int32_(name) \
- extern ::testing::internal::Int32 GTEST_FLAG(name)
+ GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
#define GTEST_DECLARE_string_(name) \
- extern ::testing::internal::String GTEST_FLAG(name)
+ GTEST_API_ extern ::testing::internal::String GTEST_FLAG(name)
// Macros for defining flags.
#define GTEST_DEFINE_bool_(name, default_val, doc) \
- bool GTEST_FLAG(name) = (default_val)
+ GTEST_API_ bool GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_int32_(name, default_val, doc) \
- ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
+ GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_string_(name, default_val, doc) \
- ::testing::internal::String GTEST_FLAG(name) = (default_val)
+ GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val)
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
// to *value and returns true; otherwise leaves *value unchanged and returns
diff --git a/include/gtest/internal/gtest-string.h b/include/gtest/internal/gtest-string.h
index 280645e6..d1d0297c 100644
--- a/include/gtest/internal/gtest-string.h
+++ b/include/gtest/internal/gtest-string.h
@@ -73,7 +73,7 @@ namespace internal {
//
// In order to make the representation efficient, the d'tor of String
// is not virtual. Therefore DO NOT INHERIT FROM String.
-class String {
+class GTEST_API_ String {
public:
// Static utility methods
@@ -326,7 +326,7 @@ inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
// Gets the content of the StrStream's buffer as a String. Each '\0'
// character in the buffer is replaced with "\\0".
-String StrStreamToString(StrStream* stream);
+GTEST_API_ String StrStreamToString(StrStream* stream);
// Converts a streamable value to a String. A NULL pointer is
// converted to "(null)". When the input value is a ::string,