Create separate dllexport marking points for clang and msvc. (#2229)

* add FMT_INSTANTIATION_DEF_API for msvc

This should fix https://github.com/fmtlib/fmt/issues/2228

To fix difference dllexport requirements
msvc:  dllexport at template instantiation definition in format.cc
clang: dllexport at template instantiation declaration (extern template) in format.h
This commit is contained in:
denchat
2021-04-17 02:34:18 +07:00
committed by GitHub
parent f4bbc54cc4
commit 52bd62c72f
3 changed files with 16 additions and 3 deletions

View File

@@ -233,8 +233,19 @@
#ifndef FMT_EXTERN_TEMPLATE_API
# define FMT_EXTERN_TEMPLATE_API
#endif
#ifndef FMT_INSTANTIATION_DECL_API
# define FMT_INSTANTIATION_DECL_API FMT_API
#ifndef FMT_INSTANTIATION_DECL_API // clang marks dllexport at extern template.
# ifndef _MSC_VER
# define FMT_INSTANTIATION_DECL_API FMT_API
# else
# define FMT_INSTANTIATION_DECL_API
# endif
#endif
#ifndef FMT_INSTANTIATION_DEF_API // msvc marks dllexport at the definition itself.
# ifndef _MSC_VER
# define FMT_INSTANTIATION_DEF_API
# else
# define FMT_INSTANTIATION_DEF_API FMT_API
# endif
#endif
#ifndef FMT_HEADER_ONLY