xref: /reactos/sdk/include/ucrt/new.h (revision 04e0dc4a)
1 //
2 // new.h
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The C++ memory allocation library functionality
7 //
8 #pragma once
9 #ifndef _INC_NEW // include guard for 3rd party interop
10 #define _INC_NEW
11 
12 #include <corecrt.h>
13 #include <vcruntime_new_debug.h>
14 
15 #ifdef __cplusplus
16 
17     #if !defined _MSC_EXTENSIONS && !defined _CRTBLD && !defined _CORECRT_BUILD
18         #include <new>
19     #endif
20 
21     #if defined _MSC_EXTENSIONS && !defined _CORECRT_BUILD
22         #include <crtdefs.h>
23 
24         namespace std
25         {
26             typedef void (__CRTDECL* new_handler)();
27 
28             #ifdef _M_CEE
29                 typedef void (__clrcall* _new_handler_m) ();
30             #endif
31 
32             _CRTIMP2 new_handler __cdecl set_new_handler(_In_opt_ new_handler _NewHandler) throw();
33         }
34 
35         #ifdef _M_CEE
36             using ::std::_new_handler_m;
37         #endif
38 
39         using ::std::new_handler;
40         using ::std::set_new_handler;
41     #endif
42 
43 #endif // __cplusplus
44 
45 #pragma warning(push)
46 #pragma warning(disable: _UCRT_DISABLED_WARNINGS)
47 _UCRT_DISABLE_CLANG_WARNINGS
48 
49 _CRT_BEGIN_C_HEADER
50 
51 
52 
53 typedef int (__CRTDECL* _PNH)(size_t);
54 
55 _PNH __cdecl _query_new_handler(void);
56 _PNH __cdecl _set_new_handler(_In_opt_ _PNH _NewHandler);
57 
58 // new mode flag -- when set, makes malloc() behave like new()
59 _ACRTIMP int __cdecl _query_new_mode(void);
60 _ACRTIMP int __cdecl _set_new_mode(_In_ int _NewMode);
61 
62 
63 
64 _CRT_END_C_HEADER
65 _UCRT_RESTORE_CLANG_WARNINGS
66 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
67 
68 #endif // _INC_NEW
69