Using Perl, how can I determine whether my program is running on 32 bit Windows or 64 bit Windows?
Is there any API available?
I can think of a couple of opt
MSDN recommends this logic (jeezus, why does this have to be so complicated?) http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
IF PROCESSOR_ARCHITECTURE == amd64 OR
PROCESSOR_ARCHITEW6432 == amd64 THEN
// OS is 64bit
ELSE
// OS is 32bit
END IF
here's how I used it in my script (note that the MSDN example messes up the capitalization of the variable values, at least on Win7, so I do a case insensitive compare)
if (uc($ENV{PROCESSOR_ARCHITECTURE}) eq "AMD64" ||
uc($ENV{PROCESSOR_ARCHITEW6432}) eq "AMD64") {
push @impactBinaries, "C:/Xilinx/13.1/LabTools/LabTools/bin/nt64/impact.exe";
} else {
push @impactBinaries, "C:/Xilinx/13.1/LabTools/LabTools/bin/nt/impact.exe";
}