Boost logo

Boost Users :

Subject: Re: [Boost-users] cross-compilation x86_64-w64-ming32: undefined reference to `InterlockedIncrement'
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-09-07 03:31:41


Le 07/09/13 07:35, Frédéric Bron a écrit :
>> I have exactly the same issue with MinGW-builds gcc-4.8.1-x86_64-posix-seh
>> building boost 1.54.0. It also crashes cxx1plus.exe as I build it (which is
>> probably another problem).
>> Did you manage to construct a workaround?
> Well I stopped working on that. I was expecting that somebody could
> help with the content of <boost/detail/interlocked.hpp> but got no
> answer.
>
> I imagine that
> extern "C" long InterlockedIncrement( long volatile * );
> should be
> extern "C" __attribute__((dllimport)) long
> __attribute__((__stdcall__)) InterlockedIncrement( long volatile * );
> as it is in 32 bits.
>
> I have now looked a bit further: among the preprocessor variable
> checked in <boost/detail/interlocked.hpp>, here are the differences
> when compiling with i686-w64-mingw32-g++ or x86_64-w64-mingw32-g++:
>
> 1. in both cases, the following variables are undefined:
> WIN32 __CYGWIN__ MINGW64 _M_IA64 BOOST_MSVC BOOST_INTEL_WIN _WIN32_WCE _MSC_VER
>
> 2. in both cases, the following variables are defined with value 1:
> _WIN32 __WIN32
>
> 3. variable _M_AMD64 is undefined with i686-w64-mingw32-g++ and
> defined with value 100 with x86_64-w64-mingw32-g++.
>
> Does this help? In particular, is it normal that _WIN32 and __WIN32
> are defined when targetting win64? Is it normal that MINGW64 is always
> undefined although I use a W64 compiler?
>
Hi,

I suspect you mean __MINGW64__.

#if defined(__MINGW64__)
#define BOOST_INTERLOCKED_IMPORT
#else
#define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
#endif

If not. Could you check if __MINGW64__ is defined?

Best,
Vicente


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net