Discussion:
WIN32 symbol definition in rules\makefile_defs_msvc.bkl
(too old to reply)
Francesco Montorsi
2010-03-03 22:11:24 UTC
Permalink
Hi Vaclav,
I've found that for all MSVC formats Bakefile always defines the WIN32
symbol... this is at least misleading on 64bit platforms: all source files gets
compiled with /DWIN32 and with no 64-bit symbols (apparently).

The definition of symbol WIN32 is not really required since the cl compiler
automatically defines the _WIN32 symbol on 32 bit platforms and both the _WIN32
and _WIN64 symbols on 64 bit platforms...
should this be considered a bakefile bug which has to be fixed (by removing the
relative <define>WIN32</define> line) ?

Thanks,
Francesco


PS: this problem was found while discussing 64bit compilation of wxWidgets; see
http://groups.google.com/group/wx-
dev/browse_thread/thread/3c7579dcf0b98567/eeed0161aa30ef31#eeed0161aa30ef31
Vaclav Slavik
2010-03-04 06:24:57 UTC
Permalink
Post by Francesco Montorsi
The definition of symbol WIN32 is not really required since the cl
compiler automatically defines the _WIN32 symbol on 32 bit platforms
and both the _WIN32 and _WIN64 symbols on 64 bit platforms...
should this be considered a bakefile bug which has to be fixed (by
removing the relative <define>WIN32</define> line) ?
Not so fast. The reason these are defined is -- if memory serves -- that
VC++ "native", manually created projects, define it. So Bakefile does it
to generate as native projects as possible [*], and msvc format does it
to be fully compatible with the project files.

So while yes, I think we can remove them safely, I'd prefer to do
exactly what native projects do (unless it would be too complicated to
implement, in which case just remove WIN32 definition). Do you know what
do manually created projects do in this regard?

Also, does the resource compiler define _WIN32 too?

Regards,
Vaclav

[*] Vadim in particular is quite vocal about having this property.
Francesco Montorsi
2010-03-05 21:06:54 UTC
Permalink
Hi,
Post by Vaclav Slavik
So while yes, I think we can remove them safely, I'd prefer to do
exactly what native projects do (unless it would be too complicated to
implement, in which case just remove WIN32 definition). Do you know what
do manually created projects do in this regard?
if I manually create a "Win32 project" using MSVC wizard it indeed
creates a project where the WIN32 symbol is in the preprocessor symbols.
I think that the WIN32 symbol should be removed only from the "msvc" format
and preserved in the MSVC IDE project formats.
Post by Vaclav Slavik
Also, does the resource compiler define _WIN32 too?
yes, it does (although it does not define _WINDOWS -- thus bakefile correctly
adds it currently). But unlike reported above for the preprocessor,
if I manually create a "Win32 project" using MSVC wizard it creates
a project where the WIN32 symbol is NOT in the preprocessor symbols
for the RC compiler.

Francesco
Vaclav Slavik
2010-03-09 07:03:00 UTC
Permalink
Hi,

I'm forwarding Vadim's take on this. Short version (and I agree):
nothing is broken by having WIN32 defined, so it's probably best to
leave things as they are.

Vaclav

-------- Forwarded Message --------
From: Vadim Zeitlin <***@tt-solutions.com>
To: ***@fastmail.fm
Subject: WIN32/64
Date: Tue, 9 Mar 2010 00:45:10 +0100

Hi,
That's not the issue. What I don't know is what to do with WIN32 in x86
builds -- either keep it (bad, because it somehow breaks x64 builds?)
No, it doesn't break them AFAIK but I just thought that it would be
inconsistent to define WIN32 but not WIN64 and I didn't think that we
needed to define the latter.
or remove it from both projects and makefiles (bad, because different
from native vcprojs)
Agreed, we really should create the projects as close to the native ones
as possible.
or keep it in projects and remove from makefiles (bad,
because inconsistent between different ways of using VC -- IIRC you
disliked this in other situations)....
Yes, it's probably better to avoid this without any good reason.


Anyhow, AFAICS you can't create a new X64 project with MSVC (at least 9, I
didn't test 10 yet but as it uses MSBuild it's probably irrelevant to this
discussion anyhow). It always creates Win32 projects and then you can add
x64 platform to them but you must copy settings from win32 one when doing
it. And this means that it doesn't have WIN64 defined by default, only
the same usual WIN32. Of course, _WIN64 will be predefined by the compiler
in any case (and so will be _WIN32).

So finally I think that bakefile just shouldn't bother doing anything
special at all for msvs200xprj formats. It must keep WIN32 to be compatible
with native projects but it doesn't need to define WIN64 for this and there
doesn't seem any reason to do it anyhow. And then, for compatibility
between projects and makefiles, we don't need to define it for makefiles
neither.

Am I missing anything?
VZ

P.S. Please feel free to forward this to the ML if you think it can be
useful.

Loading...