[libcxx-commits] [libcxx] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Dec 31 03:37:10 PST 2023
================
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <__config>
+#include <cstdio>
+#include <fstream>
+
+#if defined(_LIBCPP_WIN32API)
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <io.h>
+# include <windows.h>
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 26
+_LIBCPP_EXPORTED_FROM_ABI __filebuf_native_handle_type __filebuf_native_handle(FILE* __file) noexcept {
----------------
mordante wrote:
This is another definition. Also note the first declaration claims the symbol is hidden from the ABI. This definition claims it is exported from the ABI.
Look at `__is_windows_terminal` what the proper declarations should be.
Like I did there I prefer the POSIX version in the header. Adding new symbols to the dylib is a bit harder on Apple's backdeployment targets. Keeping that code in the header makes it available on all Apple platforms.
The new function should be exported without a version restriction our dylib is always build using C++23. The declaration can be restricted to C++26, then it can' be easily used before C++26, but that is not an issue.
https://github.com/llvm/llvm-project/pull/76632
More information about the libcxx-commits
mailing list