Boost logo

Boost :

Subject: Re: [boost] [winapi] [thread] Conflicting declarations on MinGW
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-12-31 05:59:34

On 2015-12-31 13:40, Antony Polukhin wrote:
> Hi,
> Some of the Boost.DLL tests produce following warnings:
> ../boost/thread/win32/thread_primitives.hpp:175:83: warning: declaration of
> 'void* boost::detail::win32::GetModuleHandleA(const char*)' with C language
> linkage
> ../boost/detail/winapi/dll.hpp:47:1: warning: conflicts with previous
> declaration 'HINSTANCE__* GetModuleHandleA(boost::detail::winapi::LPCSTR_)'
> ../boost/thread/win32/thread_primitives.hpp:195:94: warning: declaration of
> 'int (__attribute__((__stdcall__)) *
> boost::detail::win32::GetProcAddress(void*, const char*))()' with C
> language linkage
> ../boost/detail/winapi/dll.hpp:82:1: warning: conflicts with previous
> declaration 'int (__attribute__((__stdcall__)) *
> GetProcAddress(boost::detail::winapi::HMODULE_,
> boost::detail::winapi::LPCSTR_))()'
> Andrey, Vicente what's the best way to resolve such issues?

IMO, Boost.Thread needs to be ported to Boost.WinAPI.
boost/thread/win32/thread_primitives.hpp declares extern "C" functions
in its own namespace, while Windows SDK and Boost.WinAPI declare them in
the global namespace. This is forbidden by the standard since the
functions are considered distinct by the language but mangle to the same

As an immediate solution you could define BOOST_USE_WINDOWS_H when
building your code. Both libraries should use Windows SDK directly then.

Boost list run by bdawes at, gregod at, cpdaniel at, john at