From a5ae0685a05db49d34d11b6abc26e67c794b49b8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 12 Jan 2018 02:38:00 +0100 Subject: [PATCH] Fix wxFSVolume compilation with Cygwin in 64 bits Use __LONG32, which is always 32 bits when using Cygwin, unlike long, which is 64 bits there in 64 bit builds, and so can't be used as an argument to InterlockedExchange(). Closes #16746. --- src/msw/volume.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/msw/volume.cpp b/src/msw/volume.cpp index a2932bf3d4..32e62b4980 100644 --- a/src/msw/volume.cpp +++ b/src/msw/volume.cpp @@ -68,7 +68,18 @@ static WNetCloseEnumPtr s_pWNetCloseEnum; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Globals/Statics //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static long s_cancelSearch = FALSE; + +#if defined(__CYGWIN__) && defined(__LP64__) + // We can't use long in 64 bit Cygwin build because Cygwin uses LP64 model + // (unlike all the other MSW compilers) and long is 64 bits, while + // InterlockedExchange(), with which this variable is used, requires a 32 + // bit-sized value, so use Cygwin-specific type with the right size. + typedef __LONG32 wxInterlockedArg_t; +#else + typedef long wxInterlockedArg_t; +#endif + +static wxInterlockedArg_t s_cancelSearch = FALSE; struct FileInfo {