On 2015-12-31 15:47, Agustín K-ballo Bergé wrote:
On 12/31/2015 7:59 AM, Andrey Semashev wrote:
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.
Declaring extern "C" functions in a namespace is perfectly fine. Frankly, I'm surprised and disappointed that Boost.WinAPI does not do it, and that it will litter the global namespace instead.
It did, until it caused problems with clang - similar to the ones quoted by Antony above.
The warning comes from the use of different arguments and/or return type in the declarations. I'm guessing Boost.WinAPI is using winapi's typed handles, while we can see in the warning message that Boost.Thread uses just `void`.
The types in Boost.WinAPI are the same as the ones in Windows SDK (sans the typedefs, which I assume are not essential). There are no structs in the mentioned functions, and as far as I can see the types in Boost.Thread are also the same. So the only difference seems to be the namespace in which the functions are declared.