a7f57a4753917cb67bbbd7fcd7b2ad3311bda6c7
[reactos.git] / reactos / lib / sdk / crt / startup / mscmain.c
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7 #include <windows.h>
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <stdarg.h>
11 #include <rtcapi.h>
12 #include <assert.h>
13
14 #if defined(_M_IX86)
15 #pragma comment(linker, "/alternatename:__RTC_Initialize=__RTC_NoInitialize")
16 #elif defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
17 #pragma comment(linker, "/alternatename:_RTC_Initialize=_RTC_NoInitialize")
18 #else
19 #error Unsupported platform
20 #endif
21
22 void _pei386_runtime_relocator(void)
23 {
24 }
25
26 int __mingw_init_ehandler(void)
27 {
28 /* Nothing to do */
29 return 1;
30 }
31
32 void
33 __do_global_dtors(void)
34 {
35
36 }
37
38 void
39 __do_global_ctors(void)
40 {
41
42 }
43
44 BOOL
45 WINAPI
46 _CRT_INIT0(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
47 {
48 return TRUE;
49 }
50
51 int
52 __cdecl
53 Catch_RTC_Failure(
54 int errType,
55 const wchar_t *file,
56 int line,
57 const wchar_t *module,
58 const wchar_t *format,
59 ...)
60 {
61 /* FIXME: better failure routine */
62 __debugbreak();
63 return 0;
64 }
65
66 extern
67 void
68 __cdecl
69 _RTC_NoInitialize(void)
70 {
71 /* Do nothing, if RunTmChk.lib is not pulled in */
72 }
73
74 _RTC_error_fnW
75 __cdecl
76 _CRT_RTC_INITW(
77 void *_Res0,
78 void **_Res1,
79 int _Res2,
80 int _Res3,
81 int _Res4)
82 {
83 return &Catch_RTC_Failure;
84 }
85
86 static int initialized = 0;
87
88 void
89 __main(void)
90 {
91 if (!initialized)
92 {
93 initialized = 1;
94
95 _RTC_Initialize();
96
97 __do_global_ctors ();
98 }
99 }
100
101