Greetings, Kaz Kylheku!

> Hi All, 

> In a (admittedly not current) version of 64 bit Cygwin, I'm observing a funny
> behavior:

> The GetCommandLineW function returns a command line which consists of the
> executable name only; the arguments are missing.

Why you are using native calls inside Cygwin executable?

> This issue goes away when the program is run under GDB; the arguments
> prepared by GDB do then appear in the command line.

> The issue is not seen under 32 bits.

> The repro program uses WinMain; I've not compared whether using
> main makes a difference:

You really should.

> #include <windows.h>
> #include <stdio.h>
> #include <wchar.h>

> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
>                    LPSTR lpCmdLine, int nShowCmd)
> {
>   int argc, i;
>   LPWSTR cmdline = GetCommandLineW();
>   wprintf(L"cmdline = %ls\n", cmdline);
>   return 0;
> }

Aside from the fact you shouldn't do that (calling native API's in Cygwin app
without a very good reason), what is your CYGWIN env setting?


-- 
With best regards,
Andrey Repin
Monday, January 20, 2025 01:16:12

Sorry for my terrible english...


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to