aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorvladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386>2011-05-20 00:42:22 +0000
committervladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386>2011-05-20 00:42:22 +0000
commit587c1b37c2f0b6d430fb13ce09326db0135b557c (patch)
tree9396b2a9b8eb5d3c30beb9001e983bba37bc7774 /src
parent47be72a952e672e2635c62353d25e611e9a70dac (diff)
downloadgoogletest-587c1b37c2f0b6d430fb13ce09326db0135b557c.tar.gz
googletest-587c1b37c2f0b6d430fb13ce09326db0135b557c.tar.bz2
googletest-587c1b37c2f0b6d430fb13ce09326db0135b557c.zip
Adds support for building Google Mock as a shared library (DLL).
Diffstat (limited to 'src')
-rw-r--r--src/gmock-cardinalities.cc10
-rw-r--r--src/gmock-internal-utils.cc11
-rw-r--r--src/gmock-matchers.cc7
-rw-r--r--src/gmock-spec-builders.cc10
-rw-r--r--src/gmock.cc4
-rw-r--r--src/gmock_main.cc4
6 files changed, 24 insertions, 22 deletions
diff --git a/src/gmock-cardinalities.cc b/src/gmock-cardinalities.cc
index 1a7902b4..274f98a9 100644
--- a/src/gmock-cardinalities.cc
+++ b/src/gmock-cardinalities.cc
@@ -136,20 +136,20 @@ void Cardinality::DescribeActualCallCountTo(int actual_call_count,
}
// Creates a cardinality that allows at least n calls.
-Cardinality AtLeast(int n) { return Between(n, INT_MAX); }
+GTEST_API_ Cardinality AtLeast(int n) { return Between(n, INT_MAX); }
// Creates a cardinality that allows at most n calls.
-Cardinality AtMost(int n) { return Between(0, n); }
+GTEST_API_ Cardinality AtMost(int n) { return Between(0, n); }
// Creates a cardinality that allows any number of calls.
-Cardinality AnyNumber() { return AtLeast(0); }
+GTEST_API_ Cardinality AnyNumber() { return AtLeast(0); }
// Creates a cardinality that allows between min and max calls.
-Cardinality Between(int min, int max) {
+GTEST_API_ Cardinality Between(int min, int max) {
return Cardinality(new BetweenCardinalityImpl(min, max));
}
// Creates a cardinality that allows exactly n calls.
-Cardinality Exactly(int n) { return Between(n, n); }
+GTEST_API_ Cardinality Exactly(int n) { return Between(n, n); }
} // namespace testing
diff --git a/src/gmock-internal-utils.cc b/src/gmock-internal-utils.cc
index dd38132a..470fc447 100644
--- a/src/gmock-internal-utils.cc
+++ b/src/gmock-internal-utils.cc
@@ -51,7 +51,7 @@ namespace internal {
// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
// treated as one word. For example, both "FooBar123" and
// "foo_bar_123" are converted to "foo bar 123".
-string ConvertIdentifierNameToWords(const char* id_name) {
+GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name) {
string result;
char prev_char = '\0';
for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {
@@ -91,7 +91,7 @@ class GoogleTestFailureReporter : public FailureReporterInterface {
// Returns the global failure reporter. Will create a
// GoogleTestFailureReporter and return it the first time called.
-FailureReporterInterface* GetFailureReporter() {
+GTEST_API_ FailureReporterInterface* GetFailureReporter() {
// Points to the global failure reporter used by Google Mock. gcc
// guarantees that the following use of failure_reporter is
// thread-safe. We may need to add additional synchronization to
@@ -107,7 +107,7 @@ static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex);
// Returns true iff a log with the given severity is visible according
// to the --gmock_verbose flag.
-bool LogIsVisible(LogSeverity severity) {
+GTEST_API_ bool LogIsVisible(LogSeverity severity) {
if (GMOCK_FLAG(verbose) == kInfoVerbosity) {
// Always show the log if --gmock_verbose=info.
return true;
@@ -128,8 +128,9 @@ bool LogIsVisible(LogSeverity severity) {
// stack_frames_to_skip is treated as 0, since we don't know which
// function calls will be inlined by the compiler and need to be
// conservative.
-void Log(LogSeverity severity, const string& message,
- int stack_frames_to_skip) {
+GTEST_API_ void Log(LogSeverity severity,
+ const string& message,
+ int stack_frames_to_skip) {
if (!LogIsVisible(severity))
return;
diff --git a/src/gmock-matchers.cc b/src/gmock-matchers.cc
index a5e6824d..63f3859b 100644
--- a/src/gmock-matchers.cc
+++ b/src/gmock-matchers.cc
@@ -67,7 +67,7 @@ namespace internal {
// Joins a vector of strings as if they are fields of a tuple; returns
// the joined string.
-string JoinAsTuple(const Strings& fields) {
+GTEST_API_ string JoinAsTuple(const Strings& fields) {
switch (fields.size()) {
case 0:
return "";
@@ -89,8 +89,9 @@ string JoinAsTuple(const Strings& fields) {
// 'negation' is false; otherwise returns the description of the
// negation of the matcher. 'param_values' contains a list of strings
// that are the print-out of the matcher's parameters.
-string FormatMatcherDescription(bool negation, const char* matcher_name,
- const Strings& param_values) {
+GTEST_API_ string FormatMatcherDescription(bool negation,
+ const char* matcher_name,
+ const Strings& param_values) {
string result = ConvertIdentifierNameToWords(matcher_name);
if (param_values.size() >= 1)
result += " " + JoinAsTuple(param_values);
diff --git a/src/gmock-spec-builders.cc b/src/gmock-spec-builders.cc
index aa33cc44..c192f96c 100644
--- a/src/gmock-spec-builders.cc
+++ b/src/gmock-spec-builders.cc
@@ -53,12 +53,12 @@ namespace internal {
// Protects the mock object registry (in class Mock), all function
// mockers, and all expectations.
-GTEST_DEFINE_STATIC_MUTEX_(g_gmock_mutex);
+GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_gmock_mutex);
// Logs a message including file and line number information.
-void LogWithLocation(testing::internal::LogSeverity severity,
- const char* file, int line,
- const string& message) {
+GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
+ const char* file, int line,
+ const string& message) {
::std::ostringstream s;
s << file << ":" << line << ": " << message << ::std::endl;
Log(severity, s.str(), 0);
@@ -240,7 +240,7 @@ void ExpectationBase::UntypedTimes(const Cardinality& a_cardinality) {
// Points to the implicit sequence introduced by a living InSequence
// object (if any) in the current thread or NULL.
-ThreadLocal<Sequence*> g_gmock_implicit_sequence;
+GTEST_API_ ThreadLocal<Sequence*> g_gmock_implicit_sequence;
// Reports an uninteresting call (whose description is in msg) in the
// manner specified by 'reaction'.
diff --git a/src/gmock.cc b/src/gmock.cc
index 700bcb2e..e06acc5c 100644
--- a/src/gmock.cc
+++ b/src/gmock.cc
@@ -169,13 +169,13 @@ void InitGoogleMockImpl(int* argc, CharType** argv) {
// Since Google Test is needed for Google Mock to work, this function
// also initializes Google Test and parses its flags, if that hasn't
// been done.
-void InitGoogleMock(int* argc, char** argv) {
+GTEST_API_ void InitGoogleMock(int* argc, char** argv) {
internal::InitGoogleMockImpl(argc, argv);
}
// This overloaded version can be used in Windows programs compiled in
// UNICODE mode.
-void InitGoogleMock(int* argc, wchar_t** argv) {
+GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv) {
internal::InitGoogleMockImpl(argc, argv);
}
diff --git a/src/gmock_main.cc b/src/gmock_main.cc
index 9d8aea22..bd5be03b 100644
--- a/src/gmock_main.cc
+++ b/src/gmock_main.cc
@@ -41,9 +41,9 @@
#if GTEST_OS_WINDOWS_MOBILE
# include <tchar.h> // NOLINT
-int _tmain(int argc, TCHAR** argv) {
+GTEST_API_ int _tmain(int argc, TCHAR** argv) {
#else
-int main(int argc, char** argv) {
+GTEST_API_ int main(int argc, char** argv) {
#endif // GTEST_OS_WINDOWS_MOBILE
std::cout << "Running main() from gmock_main.cc\n";
// Since Google Mock depends on Google Test, InitGoogleMock() is