Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly export buffer<char> for MSVC #3132

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,14 @@ template <typename T> class buffer {
}
};

#if defined(FMT_MSC_VERSION)
Youw marked this conversation as resolved.
Show resolved Hide resolved
# ifdef FMT_EXPORT
extern template class buffer<char>;
# else
template class FMT_API buffer<char>;
# endif
#endif

struct buffer_traits {
explicit buffer_traits(size_t) {}
auto count() const -> size_t { return 0; }
Expand Down
7 changes: 7 additions & 0 deletions src/format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ template FMT_API auto locale_ref::get<std::locale>() const -> std::locale;

// Explicit instantiations for char.

#if defined(FMT_MSC_VERSION)
Youw marked this conversation as resolved.
Show resolved Hide resolved
// ostream does it implicitly, so we need make it explicitly
// otherwise we get ODR violation when {fmt} is built as a shared library
// and fmt/os.h is not included by the user
Youw marked this conversation as resolved.
Show resolved Hide resolved
template class FMT_API buffer<char>;
#endif

template FMT_API auto thousands_sep_impl(locale_ref)
-> thousands_sep_result<char>;
template FMT_API auto decimal_point_impl(locale_ref) -> char;
Expand Down