-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathentry_winmain.c
67 lines (61 loc) · 1.53 KB
/
entry_winmain.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Win32 UTF-8 wrapper
*
* ----
*
* WinMain() entry point.
* Compile or #include this file as part of your sources if your program runs
* in the graphical Windows subsystem and should not open a console window.
*/
#include "src/entry.h"
int __stdcall wWinMain(
// Avoid redefinition errors if wWinMain() was declared before, but don't
// depend on it to keep compilation times low.
#ifdef _WINBASE_
HINSTANCE hInstance,
HINSTANCE hNull,
LPWSTR lpCmdLine,
#else
void *hInstance,
void *hNull,
unsigned short *lpCmdLine,
#endif
int nCmdShow
)
{
(void)hInstance;
(void)hNull;
(void)lpCmdLine;
(void)nCmdShow;
return win32_utf8_entry(win32_utf8_main);
}
// If both WinMain() and wWinMain() are defined...
// • Visual Studio (or more specifically, LINK.EXE) defaults to WinMain()
// • Pelles C defaults to wWinMain(), without even printing a "ambiguous
// entry point" warning
// • MinGW/GCC doesn't care, and expects wWinMain() if you specify -municode
// and -mwindows, and WinMain() if you only specify -mwindows.
// Thus, we keep WinMain() as a convenience fallback for GCC.
#ifndef _MSC_VER
int __stdcall WinMain(
// Avoid redefinition errors if WinMain() was declared before, but don't
// depend on it to keep compilation times low.
#ifdef _WINBASE_
HINSTANCE hInstance,
HINSTANCE hNull,
LPSTR lpCmdLine,
#else
void *hInstance,
void *hNull,
const char *lpCmdLine,
#endif
int nCmdShow
)
{
(void)hInstance;
(void)hNull;
(void)lpCmdLine;
(void)nCmdShow;
return win32_utf8_entry(win32_utf8_main);
}
#endif