aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-11-13 13:25:10 +0100
committerbfredl <bjorn.linse@gmail.com>2024-11-21 12:41:15 +0100
commitbe89d520d7e9ad6c574c259a10f282177fb5dd4a (patch)
treea914be3ca2c3e4196a97bc072e4ea2cc55962333 /src/nvim/main.c
parentf164e1e35c4144baa55dda1120be6c75fb250c4b (diff)
downloadrneovim-be89d520d7e9ad6c574c259a10f282177fb5dd4a.tar.gz
rneovim-be89d520d7e9ad6c574c259a10f282177fb5dd4a.tar.bz2
rneovim-be89d520d7e9ad6c574c259a10f282177fb5dd4a.zip
refactor(windows)!: only support UCRT, even for mingw
The newer UCRT runtime has native support for UTF-8, including forcing it as the active codepage even before `main()` is called. This means the c runtime will properly convert windows WCHAR:s into UTF-8 bytes, as early as the argv/argc params to `main()` . Whereas MSVCRT does not support this reliably and required us to use `wmain()`. Only MSVC supports using manifest files directly as source files. The solution for other Windows toolchains is to use a .rc file.
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 695bd4c95a..dc4969759d 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -111,6 +111,9 @@
#ifdef MSWIN
# include "nvim/os/os_win_console.h"
+# ifndef _UCRT
+# error UCRT is the only supported C runtime on windows
+# endif
#endif
#if defined(MSWIN) && !defined(MAKE_LIB)
@@ -241,22 +244,10 @@ void early_init(mparm_T *paramp)
#ifdef MAKE_LIB
int nvim_main(int argc, char **argv); // silence -Wmissing-prototypes
int nvim_main(int argc, char **argv)
-#elif defined(MSWIN)
-int wmain(int argc, wchar_t **argv_w) // multibyte args on Windows. #7060
#else
int main(int argc, char **argv)
#endif
{
-#if defined(MSWIN) && !defined(MAKE_LIB)
- char **argv = xmalloc((size_t)argc * sizeof(char *));
- for (int i = 0; i < argc; i++) {
- char *buf = NULL;
- utf16_to_utf8(argv_w[i], -1, &buf);
- assert(buf);
- argv[i] = buf;
- }
-#endif
-
argv0 = argv[0];
if (!appname_is_valid()) {