From e1cc005f4c5a14069ac7492fbe107e44cdff30c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florin=20Cri=C8=99an?= Date: Fri, 28 May 2021 11:06:59 +0300 Subject: [PATCH] #3420 Properly declare all overloads of testing::internal::PrintTo as DLL exports This was causing the following linker error on Microsoft Visual C++ when compiling as a DLL: ``` googletest-printers-test.cc.obj : error LNK2019: unresolved external symbol "void __cdecl testing::internal::PrintTo(char16_t const *,class std::basic_ostream > *)" (?PrintTo@internal@testing@@YAXPEB_SPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: static void __cdecl testing::internal::UniversalPrinter::Print(char16_t const * const &,class std::basic_ostream > *)" (?Print@?$UniversalPrinter@PEB_S@internal@testing@@SAXAEBQEB_SPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) googletest-printers-test.cc.obj : error LNK2019: unresolved external symbol "void __cdecl testing::internal::PrintTo(char32_t const *,class std::basic_ostream > *)" (?PrintTo@internal@testing@@YAXPEB_UPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: static void __cdecl testing::internal::UniversalPrinter::Print(char32_t const * const &,class std::basic_ostream > *)" (?Print@?$UniversalPrinter@PEB_U@internal@testing@@SAXAEBQEB_UPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) ``` --- googletest/include/gtest/gtest-printers.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 978420e8..076c9de1 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -501,18 +501,18 @@ inline void PrintTo(unsigned char* s, ::std::ostream* os) { } #ifdef __cpp_char8_t // Overloads for u8 strings. -void PrintTo(const char8_t* s, ::std::ostream* os); +GTEST_API_ void PrintTo(const char8_t* s, ::std::ostream* os); inline void PrintTo(char8_t* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } #endif // Overloads for u16 strings. -void PrintTo(const char16_t* s, ::std::ostream* os); +GTEST_API_ void PrintTo(const char16_t* s, ::std::ostream* os); inline void PrintTo(char16_t* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); } // Overloads for u32 strings. -void PrintTo(const char32_t* s, ::std::ostream* os); +GTEST_API_ void PrintTo(const char32_t* s, ::std::ostream* os); inline void PrintTo(char32_t* s, ::std::ostream* os) { PrintTo(ImplicitCast_(s), os); }