Boost C++ Libraries: Ticket #5030: Windows API declaration mismatch https://svn.boost.org/trac10/ticket/5030 <p> Windows API declaration in Interprocess (win32api.hpp) conflicts with declaration of the same API in other modules. As an example, API function <a class="missing wiki">FileTimeToLocalFileTime</a>() is declared in win32api.hpp as: </p> <pre class="wiki">extern "C" __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const interprocess_filetime *in, interprocess_filetime *out); </pre><p> while in Boost <a class="missing wiki">DateTime</a> (filetime_functions.hpp) is declared as: </p> <pre class="wiki"> __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const FILETIME* lpFileTime, const FILETIME* lpLocalFileTime); </pre><p> In MinGW-gcc4.5.0 it shows the following warning: </p> <pre class="wiki">c:\msys\1.0\local\include\boost-1.45/boost/interprocess/detail/win32_api.hpp:795:138: warning: declaration of 'int boost::interprocess::winapi::FileTimeToLocalFileTime(const boost::interprocess::winapi::interprocess_filetime*, const boost::interprocess::winapi::interprocess_filetime*)' with C language linkage c:\msys\1.0\local\include\boost-1.45/boost/date_time/filetime_functions.hpp:58:45: warning: conflicts with previous declaration 'int boost::date_time::winapi::FileTimeToLocalFileTime(const boost::date_time::winapi::FILETIME*, boost::date_time::winapi::FILETIME*)' </pre><p> The warning does not prevent a successful build, but may introduce noise in the build report. </p> <p> In order to fix it, I changed the following lines in Interprocess win32api.hpp: </p> <pre class="wiki">extern "C" __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const interprocess_filetime *in, const interprocess_filetime *out); Changed to (removed "extern "C"" and "const"): __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const interprocess_filetime *in, interprocess_filetime *out); </pre><pre class="wiki">inline bool file_time_to_local_file_time (const interprocess_filetime *in, const interprocess_filetime *out) { return 0 != FileTimeToLocalFileTime(in, out); } Changed to (removed "const"): inline bool file_time_to_local_file_time (const interprocess_filetime *in, interprocess_filetime *out) { return 0 != FileTimeToLocalFileTime(in, out); } </pre><p> This may be done with all lines throwing this kind of warning. </p> <p> I don't know if this is the best solution, but it is the one that worked for me. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5030 Trac 1.4.3 Ion Gaztañaga Fri, 01 Apr 2011 17:47:26 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5030#comment:1 https://svn.boost.org/trac10/ticket/5030#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> In windows headers parameters are declared const and function is extern C so this should be reported to Boost.<a class="missing wiki">DateTime</a>. </p> Ticket