Win32: Expose wchar main routine only

Warned if both of `main` and `wmain` are exposed:
```
LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
```
This commit is contained in:
Nobuyoshi Nakada 2024-11-17 22:49:16 +09:00 committed by Hiroshi SHIBATA
parent b92a9905ae
commit bd95287a0f
2 changed files with 8 additions and 6 deletions

10
main.c
View file

@ -30,6 +30,12 @@
# undef RUBY_DEBUG_ENV
#endif
#ifdef _WIN32
#define main(argc, argv) w32_main(argc, argv)
static int main(int argc, char **argv);
int wmain(void) {return main(0, NULL);}
#endif
int
main(int argc, char **argv)
{
@ -47,7 +53,3 @@ main(int argc, char **argv)
return ruby_run_node(ruby_options(argc, argv));
}
}
#ifdef _WIN32
int wmain(void) {return main(0, NULL);}
#endif

View file

@ -1,10 +1,10 @@
#include <windows.h>
#include <stdio.h>
extern int main(int, char**);
extern int wmain(int, WCHAR**);
int WINAPI
WinMain(HINSTANCE current, HINSTANCE prev, LPSTR cmdline, int showcmd)
{
return main(0, NULL);
return wmain(0, NULL);
}