diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index 15fdf201d5..c83ca39995 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -1483,7 +1483,7 @@ fn (mut g Gen) ref_or_deref_arg(arg ast.CallArg, expected_type ast.Type, lang as } fn (mut g Gen) is_gui_app() bool { - $if windows { + if g.pref.os == .windows { if g.force_main_console { return false } diff --git a/vlib/v/gen/c/testdata/console_windows_program.c.must_have b/vlib/v/gen/c/testdata/console_windows_program.c.must_have new file mode 100644 index 0000000000..d6c325c1f7 --- /dev/null +++ b/vlib/v/gen/c/testdata/console_windows_program.c.must_have @@ -0,0 +1 @@ +int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){ diff --git a/vlib/v/gen/c/testdata/console_windows_program.vv b/vlib/v/gen/c/testdata/console_windows_program.vv new file mode 100644 index 0000000000..7e935d4253 --- /dev/null +++ b/vlib/v/gen/c/testdata/console_windows_program.vv @@ -0,0 +1,6 @@ +// vtest vflags: -cc msvc -os windows + +[console] +fn main() { + println('hello world') +} diff --git a/vlib/v/gen/c/testdata/gui_windows_program.c.must_have b/vlib/v/gen/c/testdata/gui_windows_program.c.must_have new file mode 100644 index 0000000000..d14abb19fe --- /dev/null +++ b/vlib/v/gen/c/testdata/gui_windows_program.c.must_have @@ -0,0 +1 @@ +int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, LPWSTR cmd_line, int show_cmd){ diff --git a/vlib/v/gen/c/testdata/gui_windows_program.vv b/vlib/v/gen/c/testdata/gui_windows_program.vv new file mode 100644 index 0000000000..d5f55ca7e6 --- /dev/null +++ b/vlib/v/gen/c/testdata/gui_windows_program.vv @@ -0,0 +1,8 @@ +// vtest vflags: -cc msvc -os windows +import sokol + +const used_import = sokol.used_import + +fn main() { + println('hello world') +} diff --git a/vlib/v/gen/c/testdata/gui_windows_program_with_console_tag.c.must_have b/vlib/v/gen/c/testdata/gui_windows_program_with_console_tag.c.must_have new file mode 100644 index 0000000000..d6c325c1f7 --- /dev/null +++ b/vlib/v/gen/c/testdata/gui_windows_program_with_console_tag.c.must_have @@ -0,0 +1 @@ +int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){ diff --git a/vlib/v/gen/c/testdata/gui_windows_program_with_console_tag.vv b/vlib/v/gen/c/testdata/gui_windows_program_with_console_tag.vv new file mode 100644 index 0000000000..bd57d9f4e6 --- /dev/null +++ b/vlib/v/gen/c/testdata/gui_windows_program_with_console_tag.vv @@ -0,0 +1,9 @@ +// vtest vflags: -cc msvc -os windows +import sokol + +const used_import = sokol.used_import + +[console] +fn main() { + println('hello world') +}