1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

windows: do not link gdi32/shell32 to console applications

* read os.args from argv when we have console
* dynamically load CommandLineToArgvW when we are GUI app
* link gdi32/shell32 in glfw module
This commit is contained in:
vitalyster
2019-12-27 11:27:19 +03:00
committed by Alexander Medvednikov
parent 55dbb8b81c
commit 3f0f8bac49
8 changed files with 65 additions and 22 deletions

View File

@@ -74,15 +74,19 @@ mut:
bInheritHandle bool
}
fn init_os_args(argc int, argv &byteptr) []string {
fn init_os_args(argc int, argv &byteptr) []string {
mut args := []string
mut args_list := &voidptr(0)
mut args_count := 0
args_list = C.CommandLineToArgvW(C.GetCommandLine(), &args_count)
for i := 0; i < args_count; i++ {
args << string_from_wide(&u16(args_list[i]))
for i := 0; i < argc; i++ {
args << string(argv[i])
}
return args
}
fn init_os_args_wide(argc int, argv &byteptr) []string {
mut args := []string
for i := 0; i < argc; i++ {
args << string_from_wide(&u16(argv[i]))
}
C.LocalFree(args_list)
return args
}