diff --git a/compiler/main.v b/compiler/main.v index 536861842f..e968d5e00a 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -355,6 +355,10 @@ fn (v mut V) generate_main() { // vlib can't have `init_consts()` cgen.genln('void init_consts() { #ifdef _WIN32 +DWORD consoleMode; +BOOL isConsole = GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &consoleMode); +int mode = isConsole ? _O_U16TEXT : _O_U8TEXT; +_setmode(_fileno(stdin), mode); _setmode(_fileno(stdout), _O_U8TEXT); SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), ENABLE_PROCESSED_OUTPUT | 0x0004); // ENABLE_VIRTUAL_TERMINAL_PROCESSING diff --git a/compiler/msvc.v b/compiler/msvc.v index 60f80da54f..e5e4350e0f 100644 --- a/compiler/msvc.v +++ b/compiler/msvc.v @@ -292,8 +292,7 @@ pub fn (v mut V) cc_msvc() { 'oleaut32.lib', 'uuid.lib', 'odbc32.lib', - 'odbccp32.lib', - 'vcruntime.lib', + 'odbccp32.lib' ] mut inc_paths := []string{} diff --git a/compiler/tests/repl/println.repl b/compiler/tests/repl/println.repl index 0a5707c9d7..d200ff4677 100644 --- a/compiler/tests/repl/println.repl +++ b/compiler/tests/repl/println.repl @@ -1,3 +1,7 @@ -println('hello world') +println('Hello, world!') +println('Привет, мир!') +println('你好世界') ===output=== -hello world +Hello, world! +Привет, мир! +你好世界 diff --git a/make.bat b/make.bat index b959c43d38..f1299d832f 100644 --- a/make.bat +++ b/make.bat @@ -34,8 +34,9 @@ if %ERRORLEVEL% NEQ 0 ( exit /b 1 ) -echo Building v.v... -v2.exe -o v.exe compiler +echo rebuild from source (twice, in case of C definitions changes) +v2.exe -o v3.exe compiler +v3.exe -o v.exe -prod compiler if %ERRORLEVEL% NEQ 0 ( echo v.exe failed to compile itself - Create an issue at 'https://github.com/vlang' exit /b 1 @@ -66,14 +67,16 @@ if %ERRORLEVEL% NEQ 0 ( goto :compileerror ) -echo rebuild from source -v2.exe -os msvc -o v.exe compiler +echo rebuild from source (twice, in case of C definitions changes) +v2.exe -os msvc -o v3.exe compiler +v3.exe -os msvc -o v.exe -prod compiler if %ERRORLEVEL% NEQ 0 ( echo V failed to build itself goto :compileerror ) del v2.exe +del v3.exe rd /s /q vc goto :success diff --git a/vlib/os/os.v b/vlib/os/os.v index f8e09411a6..57ab1f60cc 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -469,10 +469,10 @@ pub fn get_line() string { pub fn get_raw_line() string { $if windows { maxlinechars := 256 - buf := &u16(malloc(maxlinechars*2)) + buf := &byte(malloc(maxlinechars*2)) res := int( C.fgetws(buf, maxlinechars, C.stdin ) ) - len := int( C.wcslen(buf) ) - if 0 != res { return string_from_wide2( buf, len ) } + len := int( C.wcslen(&u16(buf)) ) + if 0 != res { return string_from_wide2( &u16(buf), len ) } return '' } $else {