[Mesa-dev] [PATCH v2] swr: fix windows build break
Ilia Mirkin
imirkin at alum.mit.edu
Wed Jan 4 19:39:51 UTC 2017
Sorry, I should have been more explicit. Wrap the *whole* file in
that, since it's all C-calling convention. See how it's done in, e.g.,
src/gallium/auxiliary/gallivm/lp_bld_init.h among many others. In
general, all header files should have that to make them safe to
include from both C and C++ code.
On Wed, Jan 4, 2017 at 2:36 PM, George Kyriazis
<george.kyriazis at intel.com> wrote:
> wrap lp_native_vector_width around extern "C" for C++.
> Windows decorates global variables, so when used from .cpp files, need
> to use an undecorated version.
> ---
> src/gallium/auxiliary/gallivm/lp_bld_type.h | 7 +++++++
> src/gallium/drivers/swr/swr_screen.cpp | 4 ----
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.h b/src/gallium/auxiliary/gallivm/lp_bld_type.h
> index 7fb449f..1d12974 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_type.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_type.h
> @@ -47,7 +47,14 @@
> * Using this width should give the best performance,
> * and it determines the necessary alignment of vector variables.
> */
> +#ifdef __cplusplus
> +// extern "C" for windows, since msdev decorates global vars
> +extern "C" {
> extern unsigned lp_native_vector_width;
> +}
> +#else
> +extern unsigned lp_native_vector_width;
> +#endif
>
> /**
> * Maximum supported vector width (not necessarily supported at run-time).
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index a9905d7..3b010fe 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -39,10 +39,6 @@
>
> #include "state_tracker/sw_winsys.h"
>
> -extern "C" {
> -#include "gallivm/lp_bld_limits.h"
> -}
Was that include there for nothing then? I'm not seeing a direct
connection to the lp_bld_type.h fix.
> -
> #include "jit_api.h"
>
> #include "memory/TilingFunctions.h"
> --
> 2.10.0.windows.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list