From: "Matthew K. Williams" Date: 2010-01-16T01:44:35+09:00 Subject: Re: How to know the OS architecture (32 or 64 bits)? --8323329-1358196177-1263574587=:23678 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1358196177-1263574587=:23678" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1358196177-1263574587=:23678 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 16 Jan 2010, Walton Hoops wrote: > On 1/15/2010 9:36 AM, Walton Hoops wrote: >> On 1/14/2010 4:12 PM, I=C3=B1aki Baz Castillo wrote: >>> Hi, is there a reliable way under Ruby to know the OS architecture (32 = or=20 >>> 64 >>> bits)? >>>=20 >>> I've just found RUBY_PLATFORM constant which returns "x86_64-linux" und= er=20 >>> 64 >>> bits, however it doesn't send very reliable for me. >>>=20 >>> I need a way working under Linux and BSD. Thanks for any suggestion. >>>=20 >>=20 >> I can't vouch for how accurate it is, but an OS gem was recently announc= ed=20 >> on this list. >> gem install os >>=20 >> irb(main):001:0> require 'os' >> =3D> true >> irb(main):002:0> OS.bits >> =3D> 64 >> irb(main):004:0> OS.posix? >> =3D> true >> irb(main):005:0> >>=20 >>=20 > Hmm.. it does not appear to deal with 32-bit ruby running on a 64 bit sys= tem=20 > though. > On my Windows 7 x64 (with 32-bit ruby): > irb(main):005:0> OS.bits > =3D> 32 > irb(main):006:0> 1.size > =3D> 4 > irb(main):007:0> > Correct me if I'm wrong, but don't 32bit apps running in a 64bit=20 architecture run in a special space which mimics 32 bits? If that's the=20 case, then I'd think the behaviour was as expected. Matt --8323329-1358196177-1263574587=:23678-- --8323329-1358196177-1263574587=:23678--