Thread overview
When using Win32/x86 in a version block is that the compiler or OS?
Jan 12, 2014
Gary Willoughby
Jan 12, 2014
John Colvin
Jan 12, 2014
Gary Willoughby
Jan 12, 2014
John Colvin
Jan 13, 2014
Jacob Carlborg
January 12, 2014
When using Win32/x86 in a version block, does that relate to the compiler or OS?

for example:

version(Win32)
{
    // 32bit Windows or 32bit Compiler?
}

version(X86)
{
    // 32bit OS or 32bit Compiler?
}

If these don't relate to the compiler is there any indication that the program is being compiled with a 32bit compiler?

I'm primarily asking because i need to use this to constrain dub to build different things depending on what compiler is used and on what architecture.
January 12, 2014
On Sunday, 12 January 2014 at 18:47:43 UTC, Gary Willoughby wrote:
> When using Win32/x86 in a version block, does that relate to the compiler or OS?
>
> for example:
>
> version(Win32)
> {
>     // 32bit Windows or 32bit Compiler?
> }
>
> version(X86)
> {
>     // 32bit OS or 32bit Compiler?
> }
>
> If these don't relate to the compiler is there any indication that the program is being compiled with a 32bit compiler?
>
> I'm primarily asking because i need to use this to constrain dub to build different things depending on what compiler is used and on what architecture.

version arguments are for the target architecture, not the compiler/build-environment.
January 12, 2014
On Sunday, 12 January 2014 at 19:01:05 UTC, John Colvin wrote:
> On Sunday, 12 January 2014 at 18:47:43 UTC, Gary Willoughby wrote:
>> When using Win32/x86 in a version block, does that relate to the compiler or OS?
>>
>> for example:
>>
>> version(Win32)
>> {
>>    // 32bit Windows or 32bit Compiler?
>> }
>>
>> version(X86)
>> {
>>    // 32bit OS or 32bit Compiler?
>> }
>>
>> If these don't relate to the compiler is there any indication that the program is being compiled with a 32bit compiler?
>>
>> I'm primarily asking because i need to use this to constrain dub to build different things depending on what compiler is used and on what architecture.
>
> version arguments are for the target architecture, not the compiler/build-environment.

Are there any for the compiler?
January 12, 2014
On Sunday, 12 January 2014 at 19:01:56 UTC, Gary Willoughby wrote:
> On Sunday, 12 January 2014 at 19:01:05 UTC, John Colvin wrote:
>> On Sunday, 12 January 2014 at 18:47:43 UTC, Gary Willoughby wrote:
>>> When using Win32/x86 in a version block, does that relate to the compiler or OS?
>>>
>>> for example:
>>>
>>> version(Win32)
>>> {
>>>   // 32bit Windows or 32bit Compiler?
>>> }
>>>
>>> version(X86)
>>> {
>>>   // 32bit OS or 32bit Compiler?
>>> }
>>>
>>> If these don't relate to the compiler is there any indication that the program is being compiled with a 32bit compiler?
>>>
>>> I'm primarily asking because i need to use this to constrain dub to build different things depending on what compiler is used and on what architecture.
>>
>> version arguments are for the target architecture, not the compiler/build-environment.
>
> Are there any for the compiler?

http://dlang.org/phobos/std_compiler.html perhaps?
January 13, 2014
On 2014-01-12 19:47, Gary Willoughby wrote:
> When using Win32/x86 in a version block, does that relate to the
> compiler or OS?
>
> for example:
>
> version(Win32)
> {
>      // 32bit Windows or 32bit Compiler?
> }

Microsoft 32-bit Windows systems

> version(X86)
> {
>      // 32bit OS or 32bit Compiler?
> }

Intel and AMD 32-bit processors

> If these don't relate to the compiler is there any indication that the
> program is being compiled with a 32bit compiler?

You might want to use: D_LP64 - Pointers are 64 bits (command line switch -m64). (Do not confuse this with C's LP64 model)

I don't think what you're asking for is useful. The 32bit compiler can compile both 32bit and 64bit code, at least DMD.

> I'm primarily asking because i need to use this to constrain dub to
> build different things depending on what compiler is used and on what
> architecture.

DigitalMars - DMD
GNU - GDC
LDC - LDC
SDC - SDC

A complete list of predefined versions can be found here:

http://dlang.org/version.html#PredefinedVersions

-- 
/Jacob Carlborg