Skip to content

Commit 8ef799c

Browse files
committed
builtin: fix windows build
1 parent d444f9c commit 8ef799c

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

vlib/builtin/builtin_windows.c.v

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ pub type C.LPCTSTR = &C.TCHAR
4343

4444
fn C.WriteConsoleW(voidptr, &u16, u32, &u32, voidptr) bool
4545

46-
fn C._fileno(&C.FILE) int
47-
4846
fn C._setmode(int, int) int
4947

5048
// set_stream_binary_mode disables CRT newline translation for redirected stdio streams.
@@ -74,10 +72,9 @@ fn write_buf_to_console(fd int, buf &u8, buf_len int) bool {
7472
if buf_len <= 0 || is_terminal(fd) <= 0 {
7573
return false
7674
}
77-
console_handle := if fd == 2 {
78-
C.GetStdHandle(std_error_handle)
79-
} else {
80-
C.GetStdHandle(std_output_handle)
75+
mut console_handle := C.GetStdHandle(std_output_handle)
76+
if fd == 2 {
77+
console_handle = C.GetStdHandle(std_error_handle)
8178
}
8279
if isnil(console_handle) {
8380
return false

vlib/builtin/cfns.c.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fn C.syscall(number i32, va ...voidptr) i32
278278
fn C.sysctl(name &int, namelen u32, oldp voidptr, oldlenp voidptr, newp voidptr, newlen usize) i32
279279

280280
@[trusted]
281-
fn C._fileno(i32) i32
281+
fn C._fileno(&C.FILE) i32
282282

283283
pub type C.intptr_t = voidptr
284284

vlib/os/os_windows.c.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ fn C.CreateHardLinkW(&u16, &u16, C.SECURITY_ATTRIBUTES) i32
2626
// See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getshortpathnamew
2727
fn C.GetShortPathNameW(&u16, &u16, u32) u32
2828

29+
fn C.AddVectoredExceptionHandler(u32, voidptr) voidptr
30+
2931
fn C._getpid() i32
3032

3133
const executable_suffixes = ['.exe', '.bat', '.cmd', '']

0 commit comments

Comments
 (0)