Edit

kc3-lang/SDL/src/main/winrt

Branch :

  • Show log

    Commit

  • Author : David Ludwig
    Date : 2013-09-16 22:27:30
    Hash : efb3cdca
    Message : WinRT: renamed SDL_winrt_main.cpp to indicate that it should only be used in non-XAML apps This can break builds of existing SDL/WinRT apps. To fix, remove the reference to SDL_winrt_main.cpp, then add a reference to the renamed file, SDL_winrt_main_NonXAML.cpp. If you get a build error about a missing .winmd file, enable the /ZW compiler flag for that one file (at minimum).

  • SDL_winrt_main_NonXAML.cpp
  • #include <wrl.h>
    
    /* The app's C-style main will be passed into SDL.dll as a function
       pointer, and called at the appropriate time.
    */
    extern __declspec(dllimport) int SDL_WinRT_RunApplication(int (*)(int, char **));
    extern "C" int SDL_main(int, char **);
    
    /* Prevent MSVC++ from warning about threading models when defining our
       custom WinMain.  The threading model will instead be set via a direct
       call to Windows::Foundation::Initialize (rather than via an attributed
       function).
    
       To note, this warning (C4447) does not seem to come up unless this file
       is compiled with C++/CX enabled (via the /ZW compiler flag).
    */
    #ifdef _MSC_VER
    #pragma warning(disable:4447)
    #endif
    
    /* Make sure the function to initialize the Windows Runtime gets linked in. */
    #ifdef _MSC_VER
    #pragma comment(lib, "runtimeobject.lib")
    #endif
    
    int CALLBACK  WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    {
        if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) {
            return 1;
        }
    
        SDL_WinRT_RunApplication(SDL_main);
        return 0;
    }