Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorDimitrij Mijoski2022-09-17 14:58:52 +0200
committerMartin Hořeňovský2022-09-24 15:15:50 +0200
commitc0e582e65955f84312548bcee36b962a013f262f (patch)
tree3b645976db206e81fef51f490faf98c3cf63278c /src/catch2/internal
parent0de60d8e7ead1ddd5ba8c46b901c122eac20bf94 (diff)
downloadcatch3-c0e582e65955f84312548bcee36b962a013f262f.tar.gz
Fix building as shared library with MSVC.
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_compiler_capabilities.hpp10
-rw-r--r--src/catch2/internal/catch_context.hpp4
2 files changed, 13 insertions, 1 deletions
diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp
index 9ffae596..f2320e63 100644
--- a/src/catch2/internal/catch_compiler_capabilities.hpp
+++ b/src/catch2/internal/catch_compiler_capabilities.hpp
@@ -382,5 +382,15 @@
# define CATCH_CONFIG_COLOUR_WIN32
#endif
+#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \
+ !defined( CATCH_CONFIG_STATIC )
+# ifdef Catch2_EXPORTS
+# define CATCH_EXPORT //__declspec( dllexport ) // not needed
+# else
+# define CATCH_EXPORT __declspec( dllimport )
+# endif
+#else
+# define CATCH_EXPORT
+#endif
#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
diff --git a/src/catch2/internal/catch_context.hpp b/src/catch2/internal/catch_context.hpp
index fe129705..53dc29a5 100644
--- a/src/catch2/internal/catch_context.hpp
+++ b/src/catch2/internal/catch_context.hpp
@@ -8,6 +8,8 @@
#ifndef CATCH_CONTEXT_HPP_INCLUDED
#define CATCH_CONTEXT_HPP_INCLUDED
+#include <catch2/internal/catch_compiler_capabilities.hpp>
+
namespace Catch {
class IResultCapture;
@@ -28,7 +30,7 @@ namespace Catch {
virtual void setConfig( IConfig const* config ) = 0;
private:
- static IMutableContext *currentContext;
+ CATCH_EXPORT static IMutableContext* currentContext;
friend IMutableContext& getCurrentMutableContext();
friend void cleanUpContext();
static void createContext();