Subject: [Boost-bugs] [Boost C++ Libraries] #5030: Windows API declaration mismatch
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-01-02 03:26:14
#5030: Windows API declaration mismatch
-----------------------------------+----------------------------------------
Reporter: jlcastillo@⦠| Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.45.0 | Severity: Cosmetic
Keywords: |
-----------------------------------+----------------------------------------
Windows API declaration in Interprocess (win32api.hpp) conflicts with
declaration of the same API in other modules. As an example, API function
FileTimeToLocalFileTime() is declared in win32api.hpp as:
{{{
extern "C" __declspec(dllimport) int __stdcall
FileTimeToLocalFileTime(const interprocess_filetime *in,
interprocess_filetime *out);
}}}
while in Boost DateTime (filetime_functions.hpp) is declared as:
{{{
__declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const
FILETIME* lpFileTime, const FILETIME* lpLocalFileTime);
}}}
In MinGW-gcc4.5.0 it shows the following warning:
{{{
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*)'
}}}
The warning does not prevent a successful build, but may introduce noise
in the build report.
In order to fix it, I changed the following lines in Interprocess
win32api.hpp:
{{{
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);
}}}
{{{
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); }
}}}
This may be done with all lines throwing this kind of warning.
I don't know if this is the best solution, but it is the one that worked
for me.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5030> 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:05 UTC