how to detect OS architecture?

Mike Parker aldacron at gmail.com
Mon Dec 16 04:29:53 PST 2013


On 12/16/2013 9:26 PM, Gary Willoughby wrote:
> On Monday, 16 December 2013 at 10:54:15 UTC, Hugo Florentino wrote:
>> Hi,
>>
>> I am writing a launcher to make a Windows application portable, but
>> since this application supports both x86 and x86_64, I would like to
>> detect the architecture of the OS my launcher is being run on, in
>> order to launch the proper executable.
>>
>> How can I do this?
>>
>> Regards, Hugo
>
> version (Windows)
> {
>      version (X86_64)
>      {
>          // 64bit code.
>      }
>
>      version (X86)
>      {
>          32bit code.
>      }
> }

That will tell him the version of Windows the executable was compiled 
on, but won't help him much when running a 32-bit executable on a 64-bit 
OS. He wants to detect the run-time architecture.


More information about the Digitalmars-d-learn mailing list