Can the API identify if it is running on a 32/64 bit machine?
I’m trying to fix akaizer integration and it only appears to work on 32 bit machines.
Thanks
Can the API identify if it is running on a 32/64 bit machine?
I’m trying to fix akaizer integration and it only appears to work on 32 bit machines.
Thanks
32/64 bit machines? Operating systems? Or versions of Renoise (only applies to Linux at the moment)?
Sure it works fine on 64bit machines running 32bit OSes (eg WinXP on a Core2Duo computer.) For OS you might have to run in a Compatibility Mode…
os.platform() could do this, currently it only returns a string whether you are dealing with windows, mac or Linux. I guess it is no more than logical this will be extended whether you are running on a 32-bit or 64-bit platform.
Meanwhile, i guess the workaround is using os.getenv("[environment variable name]") to get the value of a specific variable name that would reveal the bit type of the platform.
On Windows:
>>> print (os.getenv("ProgramFiles(x86)"))
C:\Program Files (x86)
If the ProgramFiles(x86) would return nil, you are most likely running a 32-bit environment.
Another Windows 64-bit environment variable is called “ProgramW6432” which should return the 64-bit path for Windows 64-bit applications (usually c:\Program files)
Thanks vV. That’s really helpful.
For everyones use the following should work (although I don’t have a 64bit Windows machine to try it).
The function should return true for 64bit Windows, and false if 32bit or not running on Windows
function is_64bit_windows()
if os.platform() == "WINDOWS" then
if os.getenv("ProgramFiles(x86)") == nil then
return false -- 32bit
else
return true -- 64bit
end
else
return false -- not Windows
end
end
it doesn’t work on my 32 bit machine.
That’s only 33% of the solution…
Akaizer also seems to be programmed for OSX and Linux.
On OSX i don’t really know the environment key for revealing a 64-bit environment. On Linux i have seen something like “HOSTTYPE”:
elseif name == "linux" then
function os.resolvers.platform(t,k)
-- we sometims have HOSTTYPE set so let's check that first
local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or ""
if find(architecture,"x86_64") then
platform = "linux-64"
elseif find(architecture,"ppc") then
platform = "linux-ppc"
else
platform = "linux"
end
return "linux"
end
True, but Akaizer on Linux and MacOS X just seem to work (32bit app on 64bit OS).