|
Boost Users : |
Subject: Re: [Boost-users] Is Boost API 32Bit only?
From: degski (degski_at_[hidden])
Date: 2017-03-19 14:58:19
On 18 March 2017 at 14:13, Andrej Georgi via Boost-users <
boost-users_at_[hidden]> wrote:
> The problem seems to be the compiler which complained about typecasting
> from "long" to "DWORD". The result was an incorrect choice for an
> overloaded function. Yes MSYS2 header include overloaded 32 Bit windows
> functions which use _int64 in contrast to original windows.
>
> The compiler prefered __int64 over DWORD for long. There are different
> solutions to this problem.
>
It sais on this page
<https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx>,
that a DWORD is a A 32-bit unsigned integer. However, this is only true on
windows, as DWORD is a typedef for "unsigned long" (a 32 bit unsigned
integer on windows). This is a problematic choice (the typedef) as long is
defined as 64 bit on all 'nix systems. Here
<https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models> you'll
find some info on the different data models. I deduce that MSYS2 or BOOST
(on this platform) mixes them (the data models) up, maybe you can roll your
own data-type:
typedef std::uint32_t MY_DWORD;
and use MY_DWORD to use the windows API.
As you can see from the last link 'long long' is always a 64 bit integer,
and not any cause of trouble ever. (notice on SPARC64 and int is 64 bit,
must be a lot of fun using 3rd party libraries).
degski
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net