From d6bdb69c62da37f13f5593cec10142f17d8e190f Mon Sep 17 00:00:00 2001 From: Fatih BAKIR Date: Mon, 20 Oct 2025 07:49:23 -0700 Subject: [PATCH] Move FMT_API from ostream class to members (#4584) Putting FMT_API on the class definition propagates it to the base class detail::buffer's members. However, MSVC not emit definitions for inline members unless it sees the symbols as FMT_API when compiling. This fix removes the FMT_API declaration from the class itself and marks individual non-inline members as FMT_API to address the issue. Fixes https://github.com/fmtlib/fmt/issues/4576 --- include/fmt/os.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fmt/os.h b/include/fmt/os.h index 40cdcdd4..9455d9d3 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -365,17 +365,17 @@ FMT_INLINE_VARIABLE constexpr auto buffer_size = detail::buffer_size(); /// A fast buffered output stream for writing from a single thread. Writing from /// multiple threads without external synchronization may result in a data race. -class FMT_API ostream : private detail::buffer { +class ostream : private detail::buffer { private: file file_; - ostream(cstring_view path, const detail::ostream_params& params); + FMT_API ostream(cstring_view path, const detail::ostream_params& params); - static void grow(buffer& buf, size_t); + FMT_API static void grow(buffer& buf, size_t); public: - ostream(ostream&& other) noexcept; - ~ostream(); + FMT_API ostream(ostream&& other) noexcept; + FMT_API ~ostream(); operator writer() { detail::buffer& buf = *this;