VirtualBox

source: vbox/trunk/src/VBox/Runtime/include/internal/compiler-vcc.h@ 96162

Last change on this file since 96162 was 95894, checked in by vboxsync, 3 years ago

IPRT/stream: Flush & cleanup standard streams in the no-CRT setup using a CRT termination callback. bugref:10261

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: compiler-vcc.h 95894 2022-07-28 08:44:28Z vboxsync $ */
2/** @file
3 * IPRT - Internal header for the Visual C++ Compiler Support Code.
4 */
5
6/*
7 * Copyright (C) 2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.215389.xyz. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef IPRT_INCLUDED_INTERNAL_compiler_vcc_h
28#define IPRT_INCLUDED_INTERNAL_compiler_vcc_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <iprt/types.h>
34
35/** @name Special sections.
36 * @{
37 */
38
39#ifdef IPRT_COMPILER_VCC_WITH_C_INIT_TERM_SECTIONS
40# pragma section(".CRT$XIA", read, long) /* start C initializers */
41# pragma section(".CRT$XIAA", read, long)
42# pragma section(".CRT$XIZ", read, long)
43
44# pragma section(".CRT$XPA", read, long) /* start early C terminators */
45# pragma section(".CRT$XPAA", read, long)
46# pragma section(".CRT$XPZ", read, long)
47
48# pragma section(".CRT$XTA", read, long) /* start C terminators */
49# pragma section(".CRT$XTAA", read, long)
50# pragma section(".CRT$XTZ", read, long)
51# define IPRT_COMPILER_TERM_CALLBACK(a_fn) \
52 __declspec(allocate(".CRT$XTAA")) PFNRT RT_CONCAT(g_rtVccTermCallback_, a_fn) = a_fn
53#endif
54
55#ifdef IPRT_COMPILER_VCC_WITH_CPP_INIT_SECTIONS
56# pragma warning(disable:5247) /* warning C5247: section '.CRT$XCA' is reserved for C++ dynamic initialization. Manually creating the section will interfere with C++ dynamic initialization and may lead to undefined behavior */
57# pragma warning(disable:5248) /* warning C5248: section '.CRT$XCA' is reserved for C++ dynamic initialization. Variables manually put into the section may be optimized out and their order relative to compiler generated dynamic initializers is unspecified */
58# pragma section(".CRT$XCA", read, long) /* start C++ initializers */
59# pragma section(".CRT$XCAA", read, long)
60# pragma section(".CRT$XCZ", read, long)
61#endif
62
63#ifdef IPRT_COMPILER_VCC_WITH_RTC_INIT_TERM_SECTIONS
64# pragma section(".rtc$IAA", read, long) /* start RTC initializers */
65# pragma section(".rtc$IZZ", read, long)
66
67# pragma section(".rtc$TAA", read, long) /* start RTC terminators */
68# pragma section(".rtc$TZZ", read, long)
69#endif
70
71#ifdef IPRT_COMPILER_VCC_WITH_TLS_CALLBACK_SECTIONS
72# pragma section(".CRT$XLA", read, long) /* start TLS callback */
73# pragma section(".CRT$XLAA", read, long)
74# pragma section(".CRT$XLZ", read, long)
75
76/** @todo what about .CRT$XDA? Dynamic TLS initializers. */
77#endif
78
79#ifdef IPRT_COMPILER_VCC_WITH_TLS_DATA_SECTIONS
80# pragma section(".tls", read, long) /* start TLS callback */
81# pragma section(".tls$ZZZ", read, long)
82
83/** @todo what about .CRT$XDA? Dynamic TLS initializers. */
84#endif
85
86/** @} */
87
88
89RT_C_DECLS_BEGIN
90
91extern unsigned _fltused;
92
93void rtVccInitSecurityCookie(void) RT_NOEXCEPT;
94void rtVccWinInitProcExecPath(void) RT_NOEXCEPT;
95int rtVccInitializersRunInit(void) RT_NOEXCEPT;
96void rtVccInitializersRunTerm(void) RT_NOEXCEPT;
97void rtVccTermRunAtExit(void) RT_NOEXCEPT;
98
99
100RT_C_DECLS_END
101
102
103#endif /* !IPRT_INCLUDED_INTERNAL_compiler_vcc_h */
104
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette