[libc-commits] [libc] [libc] Add osutils for Windows and make libc and its tests build on Windows target (PR #104676)
via libc-commits
libc-commits at lists.llvm.org
Mon Aug 19 09:36:05 PDT 2024
================
@@ -0,0 +1,22 @@
+//===------------- Windows implementation of IO utils -----------*- C++ -*-===//
+//
+// 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 "io.h"
+#include "src/__support/macros/config.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+
+namespace LIBC_NAMESPACE_DECL {
+
+void write_to_stderr(cpp::string_view msg) {
+ HANDLE stream = GetStdHandle(STD_ERROR_HANDLE);
+ WriteFile(stream, msg.data(), msg.size(), nullptr, nullptr);
----------------
overmighty wrote:
Nit: I'm not sure if it's consistent across the whole codebase, but `rg ' ::\w' libc` finds occurrences of `::` being used for C types and symbols.
```suggestion
::HANDLE stream = ::GetStdHandle(STD_ERROR_HANDLE);
::WriteFile(stream, msg.data(), msg.size(), nullptr, nullptr);
```
https://github.com/llvm/llvm-project/pull/104676
More information about the libc-commits
mailing list