| Summary: | [WinRT] [Patch] Fix support for C# UWP applications | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ethan Lee <flibitijibibo> |
| Component: | main | Assignee: | David Ludwig <dll> |
| Status: | RESOLVED FIXED | QA Contact: | David Ludwig <dll> |
| Severity: | normal | ||
| Priority: | P2 | CC: | dll, slouken |
| Version: | 2.0.6 | ||
| Hardware: | All | ||
| OS: | Windows 10 | ||
| Attachments: | Move Windows::Foundation::Initialize to SDL2.dll, from SDL_main | ||
This change looks fine to me, and runs ok on my system. I also tried testing it against the older, WinRT, WinMain-providing file (Ethan's patch alters it a bit, along with some code in SDL's dll), and it still works ok. Committed to hg, via https://hg.libsdl.org/SDL/rev/bd1495ebc979 Thanks, Ethan! Thanks! |
Created attachment 3026 [details] Move Windows::Foundation::Initialize to SDL2.dll, from SDL_main Attached is a patch that moves Windows::Foundation::Initialize out of the WinMain function into the DLL. Functionally this should be no different for existing applications, but for C# applications this allows us to use SDL2's UWP support by simply calling SDL_WinRTRunApp. Unfortunately we can't call Initialize ourselves from a C# environment, so this seemed like the best solution. I asked David Ludwig and at first glance he seemed to think it was okay, but WinRT can be a cruel beast... this works for us but I don't know if this somehow violates some obscure UWP rule by not having this call in the EXE. All the docs imply that it should be in WinMain but I don't see anything that explicitly says it's required.