[Spice-devel] [PATCHv2 win-agent 2/9] mingw: use standard main() entry function
Paolo Bonzini
pbonzini at redhat.com
Tue May 22 23:23:29 PDT 2012
Il 22/05/2012 14:50, Christophe Fergeau ha scritto:
>> >
>> > @@ -1226,9 +1230,9 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
>> > }
>> > VDService* vdservice = VDService::get();
>> > if (argc > 1) {
>> > - if (lstrcmpi(argv[1], TEXT("install")) == 0) {
>> > + if (strcmp(argv[1], "install") == 0) {
> No clue if this compiles/does the right thing with VC++ once we define
> UNICODE/_UNICODE, do you have any idea? mingw seems to have lstrcpmi in
> winbase.h. We should keep the comparison case insensitive.
No, with UNICODE/_UNICODE "TEXT" expands to "L" and lstrcmpi expands to
wstrcmpi. See
http://demosten-eng.blogspot.it/2008/08/mingw-and-unicode-support.html
for a possible solution:
#ifdef __GNUC__
#undef _tmain
#ifdef UNICODE
int _tmain(int argc, TCHAR* argv[]);
int main(void)
{
int argc;
argv = CommandLineToArgvW(GetCommandLineW(), &argc);
return _tmain(argc, argv);
}
#else
#define _tmain main
#endif
...
int _tmain(int argc, TCHAR* argv[])
Paolo
More information about the Spice-devel
mailing list