mirror of
https://github.com/fmtlib/fmt.git
synced 2025-02-28 16:11:28 +00:00
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:
parent
f4bbc54cc4
commit
52bd62c72f
@ -233,8 +233,19 @@
|
|||||||
#ifndef FMT_EXTERN_TEMPLATE_API
|
#ifndef FMT_EXTERN_TEMPLATE_API
|
||||||
# define FMT_EXTERN_TEMPLATE_API
|
# define FMT_EXTERN_TEMPLATE_API
|
||||||
#endif
|
#endif
|
||||||
#ifndef FMT_INSTANTIATION_DECL_API
|
#ifndef FMT_INSTANTIATION_DECL_API // clang marks dllexport at extern template.
|
||||||
|
# ifndef _MSC_VER
|
||||||
# define FMT_INSTANTIATION_DECL_API FMT_API
|
# 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
|
#endif
|
||||||
|
|
||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
|
@ -998,7 +998,9 @@ FMT_INLINE uint16_t bsr2log10(int bsr) {
|
|||||||
return data[bsr];
|
return data[bsr];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef FMT_EXPORTED
|
||||||
FMT_EXTERN template struct FMT_INSTANTIATION_DECL_API basic_data<void>;
|
FMT_EXTERN template struct FMT_INSTANTIATION_DECL_API basic_data<void>;
|
||||||
|
#endif
|
||||||
|
|
||||||
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
|
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
|
||||||
struct data : basic_data<> {};
|
struct data : basic_data<> {};
|
||||||
|
@ -57,7 +57,7 @@ vformat_to(buffer<char>&, string_view,
|
|||||||
|
|
||||||
// Clang doesn't allow dllexport on template instantiation definitions:
|
// Clang doesn't allow dllexport on template instantiation definitions:
|
||||||
// https://reviews.llvm.org/D61118.
|
// https://reviews.llvm.org/D61118.
|
||||||
template struct detail::basic_data<void>;
|
template struct FMT_INSTANTIATION_DEF_API detail::basic_data<void>;
|
||||||
|
|
||||||
// Workaround a bug in MSVC2013 that prevents instantiation of format_float.
|
// Workaround a bug in MSVC2013 that prevents instantiation of format_float.
|
||||||
int (*instantiate_format_float)(double, int, detail::float_specs,
|
int (*instantiate_format_float)(double, int, detail::float_specs,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user