David Gressett
DGres****@amli-*****
Wed Aug 1 02:24:18 JST 2018
On 31/07/18 16:06, Eli Zaretskii wrote: >>> From: David Gressett <DGres****@amli-*****> >>> Date: Mon, 30 Jul 2018 22:08:20 -0500 >>> >>> One of the nonexistent features was _getwch(), which is >>> wide-character equivalent to _getch(), which MinGW does have. >> >> What do you mean "nonexistent"? What happens if you try linking a >> program that calls it? >Should link just fine! MinGW *does* have _getwch(), insofar as it is present in libmsvcrt.a; the problem, to which David is referring, is that no one has >gotten around to adding the prototype to <conio.h>. >Should also execute fine ... provided no one tries to run it on a pre-WinXP system. So, I need to chew through conio.h as well. >>> #define _getwch _getch >>> >>> The other problem was an urecognizable main routine declaration. >>> >>> int __cdecl wmain(int argc, WCHAR* argv[]) >>> >>> did not work; it was not recognized as the main routine and caused a >>> link-time error. >>> >>> The obvious replacement >>> >>> int main(int argc, char * argv[]) >>> >>> did work. >> >> I think these replacements only work by sheer luck: where a program >> really needs wide characters, these replacements will break. The luck here was that argv[] was not used. >That was my thinking too. >> Regarding wmain, I think that MinGW should provide it in its library, >> because otherwise a program needs to retrieve and parse the >> command-line arguments by itself, it wants to support Unicode command >> lines. >This is a long-standing TO-DO. It isn't just a matter of providing a >wmain() implementation ... it also needs some way to designate it as the program entry point. Contributions gratefully considered ... I will see if I can find out how the Ada runtime does this.