From 4f919b83c2cc09d1f0c40c1bf42adb6bd1b721ec Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Thu, 2 May 2019 13:32:00 +0700 Subject: [PATCH] Add `FMT_EXTERN_TEMPLATE_API` for designate DLL export `extern template` When exporting DLL, do not designate `__declspec(dllexport)` any template that has any explicit class template declaration a.k.a. `extern template`. Instead, designate `__declspec(dllexport)` at single point where we have explicit class template definition a.k.a. normal instantiation without `extern` Note: this is a c++11 feature. --- include/fmt/core.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/fmt/core.h b/include/fmt/core.h index 8dc68e40..faeea94f 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -189,11 +189,15 @@ # define FMT_API __declspec(dllexport) # elif defined(FMT_SHARED) # define FMT_API __declspec(dllimport) +# define FMT_EXTERN_TEMPLATE_API FMT_API # endif #endif #ifndef FMT_API # define FMT_API #endif +#ifndef FMT_EXTERN_TEMPLATE_API +# define FMT_EXTERN_TEMPLATE_API +#endif #ifndef FMT_ASSERT # define FMT_ASSERT(condition, message) assert((condition) && message)