Subject: [Boost-bugs] [Boost C++ Libraries] #6145: MinGW / GCC 4.6.1 warns about conflicts between Boost.Thread and Boost.InterProcess (Win32 C API)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-18 18:28:21
#6145: MinGW / GCC 4.6.1 warns about conflicts between Boost.Thread and
Boost.InterProcess (Win32 C API)
--------------------------------------------------------+-------------------
Reporter: Cyril Othenin-Girard <cog@â¦> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.48.0 | Severity: Problem
Keywords: MinGW interprocess thread warning conflict |
--------------------------------------------------------+-------------------
I compile boost-1.48 with GCC 4.6.1 using MinGW-32 3.10 on Windows XP.
My compiling options are :
{{{
g++ -std=c++0x
}}}
I encounter the following conflicts :
{{{
~/boost-1.48/interprocess/detail/win32_api.hpp:808:116: warning:
declaration of 'void*
boost::interprocess::winapi::CreateMutexA(boost::interprocess::winapi::interprocess_security_attributes*,
int, const char*)' with C language linkage [enabled by default]
~/boost-1.48/thread/win32/thread_primitives.hpp:119:55: warning: conflicts
with previous declaration 'void*
boost::detail::win32::CreateMutexA(boost::detail::win32::_SECURITY_ATTRIBUTES*,
int, const char*)' [enabled by default]
}}}
{{{
~/boost-1.48/interprocess/detail/win32_api.hpp:813:127: warning:
declaration of 'void*
boost::interprocess::winapi::CreateSemaphoreA(boost::interprocess::winapi::interprocess_security_attributes*,
long int, long int, const char*)' with C language linkage [enabled by
default]
~/boost-1.48/thread/win32/thread_primitives.hpp:120:55: warning: conflicts
with previous declaration 'void*
boost::detail::win32::CreateSemaphoreA(boost::detail::win32::_SECURITY_ATTRIBUTES*,
long int, long int, const char*)' [enabled by default]
}}}
The problem looks like closed tickets #4217 and #5030.
It looks like "extern C" modifier make the compiler to ignore namespace
declarations, hence the conflicts.
For example, discarding namespaces, '''Boost.Thread''' declares
CreateMutexA() like this :
{{{
extern "C"
{
struct _SECURITY_ATTRIBUTES;
__declspec(dllimport) void* __stdcall
CreateMutexA('''boost::detail::win32::_SECURITY_ATTRIBUTES'''*,int,char
const*);
}
}}}
whereas '''Boost.Interprocess''' declares it like this :
{{{
struct interprocess_security_attributes
{
unsigned long nLength;
void *lpSecurityDescriptor;
int bInheritHandle;
};
extern "C" __declspec(dllimport) void * __stdcall
CreateMutexA('''boost::interprocess::winapi::interprocess_security_attributes'''*,
int, const char *);
}}}
To avoid the compiler warnings, the same type should be used for the first
parameter of CreateMutexA().
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6145> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC