Skip to content

Commit

Permalink
Restore compatibility with 10.1 ABI
Browse files Browse the repository at this point in the history
  • Loading branch information
saraedum committed Jan 3, 2024
1 parent 16e5936 commit 753119f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
52 changes: 52 additions & 0 deletions recipe/0001-Restore-symbol-from-10.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From a82712d220fc2df963c9a5463c77dd6d92ad7577 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20R=C3=BCth?= <[email protected]>
Date: Tue, 2 Jan 2024 23:43:30 -0600
Subject: [PATCH] Restore symbol from 10.1

Fixes #3785.

the write_console symbol has changed from 10.1 to 10.2. Here we restore
the symbol as introduced in 10.1.
---
include/fmt/format-inl.h | 5 +++++
include/fmt/format.h | 1 +
2 files changed, 6 insertions(+)

diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h
index e9a4ca45..daeae5b1 100644
--- a/include/fmt/format-inl.h
+++ b/include/fmt/format-inl.h
@@ -1434,6 +1434,7 @@ FMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string {
namespace detail {
#if !defined(_WIN32) || defined(FMT_WINDOWS_NO_WCHAR)
FMT_FUNC auto write_console(int, string_view) -> bool { return false; }
+FMT_FUNC auto write_console(std::FILE* f, string_view text) -> bool { return false; }
#else
using dword = conditional_t<sizeof(long) == 4, unsigned long, unsigned>;
extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( //
@@ -1444,6 +1445,10 @@ FMT_FUNC bool write_console(int fd, string_view text) {
return WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),
static_cast<dword>(u16.size()), nullptr, nullptr) != 0;
}
+
+FMT_FUNC auto write_console(std::FILE* f, string_view text) -> bool {
+ return write_console(_fileno(f), text);
+}
#endif

#ifdef _WIN32
diff --git a/include/fmt/format.h b/include/fmt/format.h
index 97f0e1fb..7637c8a0 100644
--- a/include/fmt/format.h
+++ b/include/fmt/format.h
@@ -999,6 +999,7 @@ struct is_contiguous<basic_memory_buffer<T, SIZE, Allocator>> : std::true_type {
FMT_END_EXPORT
namespace detail {
FMT_API auto write_console(int fd, string_view text) -> bool;
+FMT_API auto write_console(std::FILE* f, string_view text) -> bool;
FMT_API void print(std::FILE*, string_view);
} // namespace detail

--
2.43.0

5 changes: 4 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ package:
source:
url: https://github.com/fmtlib/fmt/archive/{{ version }}.tar.gz
sha256: {{ sha256 }}
patches:
# Upstreamed at https://github.com/fmtlib/fmt/pull/3786
- 0001-Restore-symbol-from-10.1.patch

build:
number: 0
number: 1
skip: true # [win and vc<14]
run_exports:
- {{ pin_subpackage('fmt', max_pin='x') }}
Expand Down

0 comments on commit 753119f

Please sign in to comment.