Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3200

Add support for alternative "int wmain(int argc, wchar_t * argv[])" entry point.

    XMLWordPrintable

Details

    Description

      The C/C++ runtime in Visual Studio supports an alternative "int wmain(int argc, wchar_t * argv[])" entry point. It can be used in ordinary win32 console applications. GUI applications can use the Unicode aware wWinMain entry point.

      A Qt application (Windows only, as wmain is not portable) is forced to use the classic main() entry point. Therefore, to obtain the Unicode version of the command-line arguments, either QCoreApplication::arguments() has to be used, which is slow and requires the QCoreApplication/QApplication to be instantiated (which can be a problem, if the main application class derives from QApplication and performs some lengthy initialization or tasks, which are not desirable, in case the application only wants to notify a previous running instance and quit immediately).

      Or the other way is to call GetCommandLineW() & CommandLineToArgvW() APIs. In either case, both the ANSI and Unicode versions of the command-line arguments are populated, which is not efficient.

      The suggestion is that it might be useful to take advantage of the built-in Unicode aware wmain() entry point support offered by the Visual Studio CRT.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            engvolds Morten Engvoldsen (Inactive)
            Votes:
            11 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes