1 //===-- Windows implementation of an exit function ------------------------===//
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "src/__support/macros/config.h"
10
11 // On Windows we cannot make direct syscalls since Microsoft changes system call
12 // IDs periodically. We must rely on functions exported from ntdll.dll or
13 // kernel32.dll to invoke system service procedures.
14 #define WIN32_LEAN_AND_MEAN
15 #include <Windows.h>
16
17 namespace LIBC_NAMESPACE_DECL {
18 namespace internal {
19
exit(int status)20 [[noreturn]] void exit(int status) { ::ExitProcess(status); }
21
22 } // namespace internal
23 } // namespace LIBC_NAMESPACE_DECL
24