Operating System - HP-UX
1833883 Members
1811 Online
110063 Solutions
New Discussion

Re: how to tell if the binary is 32bit or 64bit

 
Sergey Shubin
New Member

how to tell if the binary is 32bit or 64bit

Is there any system call or a convenience function that one may use to check if the binary 32 bit or 64 bit? The problem is that we need to check this from inside an application, and using "file" or "chatr" utilities seems cumbersome.
3 REPLIES 3
Stefan Farrelly
Honored Contributor

Re: how to tell if the binary is 32bit or 64bit


see; man 3e elf32_fsize

i think this will do the trick.
Im from Palmerston North, New Zealand, but somehow ended up in London...
U.SivaKumar_2
Honored Contributor

Re: how to tell if the binary is 32bit or 64bit

Hi,
Use this
#file /bin/binary

Also to find the compilation details use elfdump command.

regards,
U.SivaKumar
Innovations are made when conventions are broken
Bill McNAMARA_1
Honored Contributor

Re: how to tell if the binary is 32bit or 64bit

chatr
returns:
chatr /usr/bin/lsof
.
.
64-bit ELF executable
.
.

If 64 bit.

Later,
Bill
It works for me (tm)