how to detect OS architecture?

Marco Leise Marco.Leise at gmx.de
Mon Dec 16 05:33:42 PST 2013


Am Mon, 16 Dec 2013 12:59:52 +0100
schrieb "John Colvin" <john.loughran.colvin at gmail.com>:

> On Monday, 16 December 2013 at 11:56:07 UTC, Hugo Florentino 
> wrote:
> > On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote:
> >>> version(Windows) {
> >>>      // Windows code goes here
> >>> } else {
> >>>     // Other OS code goes here
> >>> }
> >>>
> >>> More here: http://dlang.org/version.html
> >>
> >> I think he wants determine at runtime what architecture x86 or 
> >> x64
> >> processor supprots and launch appropriate executable.
> >>
> >> I think this is what he want
> >> http://dlang.org/phobos/core_cpuid.html#.isX86_64
> >
> > Thanks, that's precisely what I needed :)
> 
> Are you sure?
> 
> This will tell you about the processor, but not necessarily about 
> what the OS supports. I don't know, but you may find that when 
> using windows 32bit on an x64 machine, cpuid will tell you the 
> cpu is 64bit, but the OS won't let you run any 64bit code.

...and your launcher would in turn fail to work on my Vista
Home Premium 32-bit, which came pre-installed on a 64-bit
system.

-- 
Marco



More information about the Digitalmars-d-learn mailing list