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).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
diff --git a/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj b/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj
index a74bb13..bd17509 100644
--- a/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj
+++ b/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj
@@ -110,6 +110,9 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
@@ -118,6 +121,9 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
@@ -133,7 +139,14 @@
<None Include="loopwave_VS2012_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main.cpp" />
+ <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+ <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+ </ClCompile>
<ClCompile Include="..\..\..\test\loopwave.c">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
diff --git a/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj b/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj
index f9b5ef0..eb2558f 100644
--- a/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj
+++ b/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj
@@ -139,7 +139,7 @@
<None Include="testthread_VS2012_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main.cpp">
+ <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
diff --git a/src/main/winrt/SDL_winrt_main.cpp b/src/main/winrt/SDL_winrt_main.cpp
deleted file mode 100644
index 81ccfb3..0000000
--- a/src/main/winrt/SDL_winrt_main.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-#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;
-}
diff --git a/src/main/winrt/SDL_winrt_main_NonXAML.cpp b/src/main/winrt/SDL_winrt_main_NonXAML.cpp
new file mode 100644
index 0000000..a9956af
--- /dev/null
+++ b/src/main/winrt/SDL_winrt_main_NonXAML.cpp
@@ -0,0 +1,36 @@
+
+#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;
+}
+