idiom to ask if you are on 32 or 64 bit linux platform?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon

    idiom to ask if you are on 32 or 64 bit linux platform?

    Hello everyone,

    I've got a ctypes wrapper to some code which seems to be different
    when compiled on 32 bit linux compared to 64 bit linux. For the
    windows version I can use sys.platform == 'win32' versus 'linux2' to
    decide whether to get the .dll or .so library to load. Having narrowed
    it down to linux I still need to choose between libKLT32.so and
    libKLT64.so

    Can someone tell me an idiom to choose the right one?

    Thanks!

    Jon
  • Christian Heimes

    #2
    Re: idiom to ask if you are on 32 or 64 bit linux platform?

    Jon wrote:
    Can someone tell me an idiom to choose the right one?
    You can check the size of a void pointer with ctypes:
    >>import ctypes
    >>ctypes.sizeof (ctypes.c_void_ p) * 8
    32

    Christian

    Comment

    • Jon

      #3
      Re: idiom to ask if you are on 32 or 64 bit linux platform?

      Christian Heimes wrote:
      You can check the size of a void pointer with ctypes:
      >>import ctypes
      >>ctypes.sizeof (ctypes.c_void_ p) * 8
      And Matt Nordhoff wrote:
      >>import platform
      >>platform.arch itecture()
      Thanks guys! Exactly what I was after.

      -Jon

      Comment

      Working...