Use wmain() if supported by the compiler/CRT instead of main().
This avoids a needless conversion from (originally Unicode) command line to ANSI by the CRT and conversion back by wxWidgets and, especially, ensures that there is no data loss if the Unicode command line arguments can't be converted into the current charset. See #14580. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6ae941a68c
commit
bfa78c63b9
@ -766,13 +766,26 @@ public:
|
|||||||
// your compiler really, really wants main() to be in your main program (e.g.
|
// your compiler really, really wants main() to be in your main program (e.g.
|
||||||
// hello.cpp). Now wxIMPLEMENT_APP should add this code if required.
|
// hello.cpp). Now wxIMPLEMENT_APP should add this code if required.
|
||||||
|
|
||||||
#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
|
// For compilers that support it, prefer to use wmain() as this ensures any
|
||||||
int main(int argc, char **argv) \
|
// Unicode strings can be passed as command line parameters and not just those
|
||||||
{ \
|
// representable in the current locale.
|
||||||
wxDISABLE_DEBUG_SUPPORT(); \
|
#if wxUSE_UNICODE && defined(__VISUALC__)
|
||||||
|
#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
|
||||||
|
int wmain(int argc, wchar_t **argv) \
|
||||||
|
{ \
|
||||||
|
wxDISABLE_DEBUG_SUPPORT(); \
|
||||||
\
|
\
|
||||||
return wxEntry(argc, argv); \
|
return wxEntry(argc, argv); \
|
||||||
}
|
}
|
||||||
|
#else // Use standard main()
|
||||||
|
#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
|
||||||
|
int main(int argc, char **argv) \
|
||||||
|
{ \
|
||||||
|
wxDISABLE_DEBUG_SUPPORT(); \
|
||||||
|
\
|
||||||
|
return wxEntry(argc, argv); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// port-specific header could have defined it already in some special way
|
// port-specific header could have defined it already in some special way
|
||||||
#ifndef wxIMPLEMENT_WXWIN_MAIN
|
#ifndef wxIMPLEMENT_WXWIN_MAIN
|
||||||
|
Loading…
Reference in New Issue
Block a user