| 1 | // | 
|---|
| 2 | // Copyright (c) Microsoft. All rights reserved. | 
|---|
| 3 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. | 
|---|
| 4 | // | 
|---|
| 5 |  | 
|---|
| 6 | // The point of a PCH file is to never reparse files that never change. | 
|---|
| 7 | // Only include files here that will almost NEVER change. Headers for the project | 
|---|
| 8 | // itself are probably inappropriate, because if you change them, the entire | 
|---|
| 9 | // project will require a recompile. Generally just put SDK style stuff here... | 
|---|
| 10 |  | 
|---|
| 11 | #ifndef WIN32_LEAN_AND_MEAN | 
|---|
| 12 | #define WIN32_LEAN_AND_MEAN | 
|---|
| 13 | #endif // WIN32_LEAN_AND_MEAN | 
|---|
| 14 | #include <windows.h> | 
|---|
| 15 |  | 
|---|
| 16 | #ifdef INTERNAL_BUILD | 
|---|
| 17 | // There are a few features that reference Microsoft internal resources. We can't build these | 
|---|
| 18 | // in the open source version. | 
|---|
| 19 | #define USE_MSVCDIS | 
|---|
| 20 |  | 
|---|
| 21 | // Disable CoreDisTools until coredistools.dll is statically-linked to the CRT, or until it is delayload linked. | 
|---|
| 22 | //#define USE_COREDISTOOLS | 
|---|
| 23 | #endif // INTERNAL_BUILD | 
|---|
| 24 |  | 
|---|
| 25 | #ifdef _MSC_VER | 
|---|
| 26 | #pragma warning(disable : 4996) // The compiler encountered a deprecated declaration. | 
|---|
| 27 |  | 
|---|
| 28 | // On Windows, we build against PAL macros that convert to Windows SEH. But we don't want all the | 
|---|
| 29 | // Contract stuff that normally gets pulled it. Defining JIT_BUILD prevents this, just as it does | 
|---|
| 30 | // when building the JIT using parts of utilcode. | 
|---|
| 31 | #define JIT_BUILD | 
|---|
| 32 |  | 
|---|
| 33 | // Defining this prevents: | 
|---|
| 34 | //   error C2338 : / RTCc rejects conformant code, so it isn't supported by the C++ Standard Library. | 
|---|
| 35 | //   Either remove this compiler option, or define _ALLOW_RTCc_IN_STL to acknowledge that you have received this | 
|---|
| 36 | //   warning. | 
|---|
| 37 | #ifndef _ALLOW_RTCc_IN_STL | 
|---|
| 38 | #define _ALLOW_RTCc_IN_STL | 
|---|
| 39 | #endif | 
|---|
| 40 |  | 
|---|
| 41 | #define MSC_ONLY(x) x | 
|---|
| 42 | #else // !_MSC_VER | 
|---|
| 43 | #define MSC_ONLY(x) | 
|---|
| 44 | #endif // !_MSC_VER | 
|---|
| 45 |  | 
|---|
| 46 | #ifndef _CRT_SECURE_NO_WARNINGS | 
|---|
| 47 | #define _CRT_SECURE_NO_WARNINGS | 
|---|
| 48 | #endif // _CRT_SECURE_NO_WARNINGS | 
|---|
| 49 |  | 
|---|
| 50 | #define _CRT_RAND_S | 
|---|
| 51 |  | 
|---|
| 52 | #include <stdio.h> | 
|---|
| 53 | #include <string.h> | 
|---|
| 54 | #include <stdlib.h> | 
|---|
| 55 | #include <stddef.h> | 
|---|
| 56 | #include <malloc.h> | 
|---|
| 57 | #include <assert.h> | 
|---|
| 58 | #include <wchar.h> | 
|---|
| 59 | #include <tchar.h> | 
|---|
| 60 | #include <specstrings.h> | 
|---|
| 61 | #include <math.h> | 
|---|
| 62 | #include <limits.h> | 
|---|
| 63 | #include <ctype.h> | 
|---|
| 64 | #include <stdarg.h> | 
|---|
| 65 |  | 
|---|
| 66 | // Getting STL to work with PAL is difficult, so reimplement STL functionality to not require it. | 
|---|
| 67 | #ifdef FEATURE_PAL | 
|---|
| 68 | #include "clr_std/string" | 
|---|
| 69 | #include "clr_std/algorithm" | 
|---|
| 70 | #else // !FEATURE_PAL | 
|---|
| 71 | #ifndef USE_STL | 
|---|
| 72 | #define USE_STL | 
|---|
| 73 | #endif // USE_STL | 
|---|
| 74 | #include <string> | 
|---|
| 75 | #include <algorithm> | 
|---|
| 76 | #endif // !FEATURE_PAL | 
|---|
| 77 |  | 
|---|
| 78 | #ifdef USE_MSVCDIS | 
|---|
| 79 | #define DISLIB | 
|---|
| 80 | #include "..\external\msvcdis\inc\msvcdis.h" | 
|---|
| 81 | #include "..\external\msvcdis\inc\disx86.h" | 
|---|
| 82 | #include "..\external\msvcdis\inc\disarm64.h" | 
|---|
| 83 | #endif // USE_MSVCDIS | 
|---|
| 84 |  | 
|---|
| 85 | #ifndef DIRECTORY_SEPARATOR_CHAR_A | 
|---|
| 86 | #define DIRECTORY_SEPARATOR_CHAR_A '\\' | 
|---|
| 87 | #endif | 
|---|
| 88 | #ifndef DIRECTORY_SEPARATOR_STR_A | 
|---|
| 89 | #define DIRECTORY_SEPARATOR_STR_A "\\" | 
|---|
| 90 | #endif | 
|---|
| 91 |  | 
|---|
| 92 | #ifndef W | 
|---|
| 93 | #ifdef PLATFORM_UNIX | 
|---|
| 94 | #define W(str) u##str | 
|---|
| 95 | #else // PLATFORM_UNIX | 
|---|
| 96 | #define W(str) L##str | 
|---|
| 97 | #endif // PLATFORM_UNIX | 
|---|
| 98 | #endif // !W | 
|---|
| 99 |  | 
|---|
| 100 | #ifndef DIRECTORY_SEPARATOR_STR_W | 
|---|
| 101 | #define DIRECTORY_SEPARATOR_STR_W W("\\") | 
|---|
| 102 | #endif | 
|---|
| 103 |  | 
|---|
| 104 | #ifdef FEATURE_PAL | 
|---|
| 105 | #define PLATFORM_SHARED_LIB_SUFFIX_A PAL_SHLIB_SUFFIX | 
|---|
| 106 | #else // !FEATURE_PAL | 
|---|
| 107 | #define PLATFORM_SHARED_LIB_SUFFIX_A ".dll" | 
|---|
| 108 | #endif // !FEATURE_PAL | 
|---|
| 109 |  | 
|---|
| 110 | #define DEFAULT_REAL_JIT_NAME_A MAKEDLLNAME_A("clrjit2") | 
|---|
| 111 | #define DEFAULT_REAL_JIT_NAME_W MAKEDLLNAME_W("clrjit2") | 
|---|
| 112 |  | 
|---|