brintos

brintos / llvm-project-archived public Read only

0
0
Text · 921 B · af3d1b9 Raw
26 lines · cpp
1//===------------- Windows implementation of IO utils -----------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "io.h"10#include "src/__support/macros/config.h"11 12// On Windows we cannot make direct syscalls since Microsoft changes system call13// IDs periodically. We must rely on functions exported from ntdll.dll or14// kernel32.dll to invoke system service procedures.15#define WIN32_LEAN_AND_MEAN16#include <Windows.h>17 18namespace LIBC_NAMESPACE_DECL {19 20void write_to_stderr(cpp::string_view msg) {21  ::HANDLE stream = ::GetStdHandle(STD_ERROR_HANDLE);22  ::WriteFile(stream, msg.data(), msg.size(), nullptr, nullptr);23}24 25} // namespace LIBC_NAMESPACE_DECL26