[Mesa-dev] [PATCH] swr: fix windows build break

George Kyriazis george.kyriazis at intel.com
Wed Jan 4 17:41:24 UTC 2017


Explicitly declare lp_native_vector_width inside an extern "C",
since we cannot include the correct header file inside extern "C".
---
 src/gallium/drivers/swr/swr_screen.cpp | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
index a9905d7..f858f68 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -21,6 +21,19 @@
  * IN THE SOFTWARE.
  ***************************************************************************/
 
+/*
+ * extern block below has to be before any #includes.
+ * Windows decorates global variables, and the first extern wins,
+ * so the first declaration of lp_native_vector_width has to be
+ * the correct one. The right approach, of course, is to include
+ * the correct .h files, however that doesn't work since
+ * header files eventually include system header files,
+ * which do not work inside extern "C".
+ */
+extern "C" {
+   extern unsigned lp_native_vector_width;
+}
+
 #include "swr_context.h"
 #include "swr_public.h"
 #include "swr_screen.h"
@@ -39,9 +52,6 @@
 
 #include "state_tracker/sw_winsys.h"
 
-extern "C" {
-#include "gallivm/lp_bld_limits.h"
-}
 
 #include "jit_api.h"
 
-- 
2.10.0.windows.1



More information about the mesa-dev mailing list