| Summary: | Getting unicode arguments for the main entry point on Windows | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Simon Hug <chli.hug> |
| Component: | main | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Windows (All) | ||
| Attachments: | Patch that makes the main entry point on Windows use the GetCommandLine path of WinMain. | ||
Fixed, thanks! https://hg.libsdl.org/SDL/rev/e093aacd58a7 |
Created attachment 2583 [details] Patch that makes the main entry point on Windows use the GetCommandLine path of WinMain. There are currently three entry points in the SDL2_main code for windows: main, wmain and WinMain. Only the latter two properly convert the arguments to UTF-8. Console applications linked with MSVC will always link with the main entry point (wmain has to be selected by manually setting the entry point). This makes it likely that such programs will not have proper unicode arguments. The attached patch moves the GetCommandLine code out of WinMain in its own function so it can also be used by main. Additionally, the application exit code is now returned by WinMain. I have done some minor testing, but plan to do some more.