How can I have my Perl script detect it's running on a 64-bit Windows machine, even if it's a 32-bit perl?
+5
A:
See this question. You check the %PROCESSOR_ARCHITECTURE%
environment variable.
Ben S
2009-09-18 18:18:01
+3
A:
Thanks Ben S.
From the link in the question you linked to: msdn blog on how to dectect process bitness
Yielded the following code: print "WIN64?: $ENV{PROCESSOR_ARCHITECTURE} \n"; print "WIN64?: $ENV{PROCESSOR_ARCHITEW6432} \n";
And the following output (32 bit perl on xp64)
WIN64?: x86
WIN64?: AMD64
Seems if you're running a 32bit app on 64 bit win, you'll need to reference PROCESSOR_ARCHITEW6432.
bdbaddog
2009-09-18 20:32:07
+1
A:
Another method, although a bit more involved, would be to check the Windows API function IsWow64Process
. An example of how to do this (in Delphi) is given in the answer to this question.
PhiS
2009-09-21 23:10:15