Updated 2014-06-05 19:39:43 by AMG

The ::tcl_platform global array (documented on the tclvars manpage) holds useful data concerning the platform on which a specific Tcl interpreter is running. This page is intended to list the values of tcl_platform on various systems. This might be useful for folks who are trying to adapt their code to different platforms.

The meaning of the element names are:

  • byteOrder - is the most significant, or least significant, byte first
  • machine - some info specific to the kind of hardware
  • os - a string identifying the operating system
  • osVersion - the version of the os
  • pathSeparator — character used to split variables like env(PATH) into a proper Tcl list (from 8.6)
  • platform - which of the major types of computers is this
  • pointerSize - bytes taken up by a void pointer (from 8.5)
  • user - user's login id
  • wordSize - number of bytes for a machine-word (actually, a long)

Optionally present members include:

  • threaded - tcl configured with --enable-threads
  • debug - a windows tcl configured with --enable-debug

Is anyone aware of any other members?

LV In Tcl 8.5, a new platform package makes available new commands such as platform::generic and platform::identify .

LV How much of this information is generated dynamically, and how much of it really is generated statically at compile time?

  • byteOrder, wordSize, and pointerSize are dynamically generated.
  • The statement which adds the threaded element is statically compiled into the system.
  • The platform entry is generated statically.
  • The os, and osVersion entries appear to be generated dynamically.
  • The machine entry is generated dynamically.
  • The user entry is generated dynamically (based on USER and LOGNAME environment variables)
  • The debug entry is statically added.

Please add the output of
  parray tcl_platform

here for your platform if it is not represented.

MSDN has documentation for the Microsoft Windows platforms [1]

What order should these be in? Alpha by platform? -- CLN

I've put the Linux entries together, annotated with processor, kernel, and distribution info. -- DJH

AIX 4.3:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = 003C87964C00
 tcl_platform(os)        = AIX
 tcl_platform(osVersion) = 4.3
 tcl_platform(platform)  = unix

AIX 5.1 on PPC:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = 0042065B4C00
 tcl_platform(os)        = AIX
 tcl_platform(osVersion) = 5.1
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

AIX 6.1 on pSeries:
  tcl_platform(byteOrder) = bigEndian
  tcl_platform(machine)   = 000BF680D600
  tcl_platform(os)        = AIX
  tcl_platform(osVersion) = 6.1
  tcl_platform(platform)  = unix
  tcl_platform(wordSize)  = 4

CYGWIN_NT-5.1 (tclsh8.5.exe, Cygwin on Windows XP Professional):
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 5.1
 tcl_platform(platform)  = unix

The last field changed from "windows" to "unix" in 2012-02.

HP-UX 10.20:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = 9000/715
 tcl_platform(os)        = HP-UX
 tcl_platform(osVersion) = B.10.20
 tcl_platform(platform)  = unix

HP-UX 11:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = 9000/782
 tcl_platform(os)        = HP-UX
 tcl_platform(osVersion) = B.11.00
 tcl_platform(platform)  = unix

HP-UX 11.11:
  tcl_platform(byteOrder) = bigEndian
  tcl_platform(machine)   = 9000/800
  tcl_platform(os)        = HP-UX
  tcl_platform(osVersion) = B.11.11
  tcl_platform(platform)  = unix
  tcl_platform(wordSize)  = 4

HP-UX 11.23 Itanium :
  tcl_platform(byteOrder) = bigEndian
  tcl_platform(machine)   = ia64
  tcl_platform(os)        = HP-UX
  tcl_platform(osVersion) = B.11.23
  tcl_platform(platform)  = unix
  tcl_platform(wordSize)  = 4

HP-UX 11.31 parisc :
  tcl_platform(byteOrder) = bigEndian
  tcl_platform(machine)   = 9000/800
  tcl_platform(os)        = HP-UX
  tcl_platform(osVersion) = B.11.31
  tcl_platform(platform)  = unix
  tcl_platform(wordSize)  = 4

IRIX 6.5:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = IP32
 tcl_platform(os)        = IRIX
 tcl_platform(osVersion) = 6.5
 tcl_platform(platform)  = unix

Linux Alpha kernel 2.2, distrib Redhat 6.2:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = alpha
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.2.19
 tcl_platform(platform)  = unix

Linux StrongARM kernel 2.4, distrib Debian 2.2
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = armv4l
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.0-test1-ac7-rmk1-crl2
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

Linux PowerPC kernel 2.4, distrib Debian 'woody':
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = ppc
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.16
 tcl_platform(platform)  = unix

Linux s/390x kernel 2.6, distrib SuSE Enterprise Server 10 SP 1:
  tcl_platform(byteOrder) = bigEndian
  tcl_platform(machine)   = s390x
  tcl_platform(os)        = Linux
  tcl_platform(osVersion) = 2.6.16.46-0.12-default
  tcl_platform(platform)  = unix
  tcl_platform(wordSize)  = 4

Linux SH4 kernel 2.4, distrib Debian unstable/testing:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = sh4
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.18-sh
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

Linux x86 kernel 2.4, distrib RedHat Enterprise Linux 3:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = ia64
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.21-47.EL
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 8

Linux x86 kernel 2.2, distrib Redhat 6.2:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i686
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.2.19
 tcl_platform(platform)  = unix

Linux x86 kernel 2.4, distrib Debian:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i686
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.7-win4lin
 tcl_platform(platform)  = unix

Linux x86 kernel 2.4 distrib Mandrake (8.1)
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i686
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.8-26mdk
 tcl_platform(platform)  = unix

Linux x86, kernel 2.4.22, distrib Slackware
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i686
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.22
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

Linux x86, kernel 2.6.8, distrib Debian, Sarge (on PC with 1GHz AMD Athlon)
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i686
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.6.8-2-386
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Linux x86, kernel 2.6.8, distrib Debian, Sarge (on PC with a classic Pentium 120)
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i586
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.6.8-2-386
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Linux x86_64, kernel 2.6.8, distrib SUSE 9.2
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = x86_64
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.6.8-24.14-default
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 8

Linux x86, kernel 2.6.21.5, distrib Slackware 12.0
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i686
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.6.21.5
 tcl_platform(platform)  = unix
 tcl_platform(tip,268)   = 1
 tcl_platform(tip,280)   = 1
 tcl_platform(wordSize)  = 4

Mac OS 8:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = ppc
 tcl_platform(os)        = MacOS
 tcl_platform(osVersion) = 8.6
 tcl_platform(platform)  = macintosh

Mac OS 9:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = ppc
 tcl_platform(os)        = MacOS
 tcl_platform(osVersion) = 9.0
 tcl_platform(platform)  = macintosh

Mac OS X:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 1.3.7
 tcl_platform(platform)  = unix

Mac OS X, officially version 10.2.3, "Jaguar":
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 6.3
 tcl_platform(platform)  = unix

Mac OS X, 10.3.9, "Panther"
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 7.9.0
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Mac OS X, 10.4.1, "Tiger"
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 8.1.0
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Mac OS X, 10.4.3, "Tiger"
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 8.3.0
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Mac OS X, 10.4.6
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 8.6.0
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Mac OS X, 10.4.8 (PowerPC)
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 8.8.0
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Mac OS X, 10.4.8 (Intel)
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 8.8.1
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Mac OS X, 10.4.10 (Intel)
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 8.10.1
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(tip,268)   = 1
 tcl_platform(tip,280)   = 1
 tcl_platform(wordSize)  = 4

Mac OS X, 10.5.1 "Leopard" (PowerPC)
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = Power Macintosh
 tcl_platform(os)        = Darwin
 tcl_platform(osVersion) = 9.1.0
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 8

Mac OS X, 10.5.1 "Leopard" (Intel) - ActiveTcl 8.5.0
 tcl_platform(byteOrder)   = littleEndian
 tcl_platform(machine)     = i386
 tcl_platform(os)          = Darwin
 tcl_platform(osVersion)   = 9.1.0
 tcl_platform(platform)    = unix
 tcl_platform(pointerSize) = 4
 tcl_platform(threaded)    = 1
 tcl_platform(wordSize)    = 4

MacOS X 10.6.2 "Snow Leopard" (Intel) - ActiveTcl 8.6
 tcl_platform(byteOrder)   = littleEndian
 tcl_platform(machine)     = i386
 tcl_platform(os)          = Darwin
 tcl_platform(osVersion)   = 10.2.0
 tcl_platform(platform)    = unix
 tcl_platform(pointerSize) = 4
 tcl_platform(threaded)    = 1
 tcl_platform(wordSize)    = 4

MacOS X 10.7.1 "Lion" (Intel) - ActiveTcl 8.5.10
 tcl_platform(byteOrder)   = littleEndian
 tcl_platform(machine)     = x86_64
 tcl_platform(os)          = Darwin
 tcl_platform(osVersion)   = 11.1.0
 tcl_platform(platform)    = unix
 tcl_platform(pointerSize) = 8
 tcl_platform(threaded)    = 1
 tcl_platform(wordSize)    = 8

DragonFlyBSD 1.0A-RELEASE
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = DragonFly
 tcl_platform(osVersion) = 1.0A-RELEASE
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

FreeBSD 4.7-STABLE x86:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = FreeBSD
 tcl_platform(osVersion) = 4.7-STABLE
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

FreeBSD 4.8-STABLE x86:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = FreeBSD
 tcl_platform(osVersion) = 4.8-STABLE
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

NetBSD 1.6(I) x86:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = NetBSD
 tcl_platform(osVersion) = 1.6I
 tcl_platform(platform)  = unix

NetBSD 2.0.2 x86:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = NetBSD
 tcl_platform(osVersion) = 2.0.2
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

OpenBSD 3.0 x86:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i386
 tcl_platform(os)        = OpenBSD
 tcl_platform(osVersion) = 3.0
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

SunOS 4:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = sun4m
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 4.1.3_U1
 tcl_platform(platform)  = unix

SPARC Solaris 2.6:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = sun4u
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 5.6
 tcl_platform(platform)  = unix

Sparc Solaris 2.7:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = sun4u
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 5.7
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1

Sparc Solaris 8:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = sun4u
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 5.8
 tcl_platform(platform)  = unix

Intel Solaris 8:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = i86pc
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 5.8
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

Sparc Solaris 9 with threads enabled:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = sun4u
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 5.9
 tcl_platform(platform)  = unix
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

Sparc Solaris 9 with threads and 64 bit enabled:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = sun4u
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 5.9
 tcl_platform(platform)  = unix
 tcl_platform(pointerSize)  = 8
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 8

Sparc Solaris 9, without threads or 64 bit enabled, Tcl 8.5.4:
 tcl_platform(byteOrder)   = bigEndian
 tcl_platform(machine)     = sun4u
 tcl_platform(os)          = SunOS
 tcl_platform(osVersion)   = 5.9
 tcl_platform(platform)    = unix
 tcl_platform(pointerSize) = 4
 tcl_platform(wordSize)    = 4

Sparc Solaris 10:
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = sun4u
 tcl_platform(os)        = SunOS
 tcl_platform(osVersion) = 5.10
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

S/390 Linux
 tcl_platform(byteOrder) = bigEndian
 tcl_platform(machine)   = s390
 tcl_platform(os)        = Linux
 tcl_platform(osVersion) = 2.4.21-20.EL
 tcl_platform(platform)  = unix
 tcl_platform(wordSize)  = 4

Tru64 UNIX:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = alpha
 tcl_platform(os)        = OSF1
 tcl_platform(osVersion) = X5.1
 tcl_platform(platform)  = unix

Windows 3.1:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Win32s
 tcl_platform(osVersion) = 1.30
 tcl_platform(platform)  = windows

Win95:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows 95
 tcl_platform(osVersion) = 4.0
 tcl_platform(platform)  = windows
 tcl_platform(wordSize)  = 4

Win98:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows 95
 tcl_platform(osVersion) = 4.10
 tcl_platform(platform)  = windows

WinNT:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 4.0
 tcl_platform(platform)  = windows

Win2000:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 5.0
 tcl_platform(platform)  = windows
 tcl_platform(wordSize)  = 4

Windows XP Home:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 5.1
 tcl_platform(platform)  = windows
 tcl_platform(wordSize)  = 4

Windows XP Professional:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(debug)     = 1
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 5.1
 tcl_platform(platform)  = windows

Windows XP Professional/Firefox 1.04 with Tcl/Tk Tclet Plugin (with [tk windowingsystem] = "win32"):
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(platform)  = windows
 tcl_platform(wordSize)  = 4

Windows Vista:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 6.0
 tcl_platform(platform)  = windows
 tcl_platform(wordSize)  = 4

Windows 2003 x64 (64-bit) running 32-bit Tcl:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = intel
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 5.2
 tcl_platform(platform)  = windows
 tcl_platform(wordSize)  = 4

Windows 2003 x64 (64-bit) running 64-bit Tcl:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = amd64
 tcl_platform(os)        = Windows NT
 tcl_platform(osVersion) = 5.2
 tcl_platform(platform)  = windows
 tcl_platform(wordSize)  = 4

Windows 7 32-bit
 tcl_platform(byteOrder)   = littleEndian
 tcl_platform(machine)     = intel
 tcl_platform(os)          = Windows NT
 tcl_platform(osVersion)   = 6.1
 tcl_platform(pointerSize) = 4
 tcl_platform(threaded)    = 1
 tcl_platform(wordSize)    = 4

Windows 7 Home Premium 64-bit
 tcl_platform(byteOrder)   = littleEndian
 tcl_platform(machine)     = intel
 tcl_platform(os)          = Windows NT
 tcl_platform(osVersion)   = 6.1
 tcl_platform(platform)    = windows
 tcl_platform(pointerSize) = 4
 tcl_platform(threaded)    = 1
 tcl_platform(wordSize)    = 4

Note: there is no way to obtain the bitsize of the OS, an important variable, e.g. when you're going to exec programs that exist in specific 32- and 64-bit versions. A quick and reliable method in distinguishing is by using the windows wmi framework as follows (but you could also use the twapi package):
 lindex [exec wmic computersystem get systemtype] 1

Responses: X86-based or x64-based

This was tested with following systems with 64-bit CPUs: Win XP 32-bit, Win7 32-bit and Win7 64-bit.

Windows 7 Home Premium 64-bit running 64-bit Tcl
 tcl_platform(byteOrder)   = littleEndian
 tcl_platform(machine)     = amd64
 tcl_platform(os)          = Windows NT
 tcl_platform(osVersion)   = 6.1
 tcl_platform(platform)    = windows
 tcl_platform(pointerSize) = 8
 tcl_platform(threaded)    = 1
 tcl_platform(wordSize)    = 4

Windows 2008 Server R2 64-bit
 tcl_platform(byteOrder)     = littleEndian
 tcl_platform(machine)       = amd64
 tcl_platform(os)            = Windows NT
 tcl_platform(osVersion)     = 6.1
 tcl_platform(pathSeparator) = ;
 tcl_platform(platform)      = windows
 tcl_platform(pointerSize)   = 8
 tcl_platform(threaded)      = 1
 tcl_platform(wordSize)      = 4

Windows/CE:
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = arm
 tcl_platform(os)        = Windows CE
 tcl_platform(osVersion) = 3.0
 tcl_platform(platform)  = windows

Windows Mobile 2003SE (eTcl):
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = arm
 tcl_platform(os)        = Windows CE
 tcl_platform(osVersion) = 4.21
 tcl_platform(platform)  = windows
 tcl_platform(threaded)  = 1
 tcl_platform(wordSize)  = 4

OS/400 V5R1M0:
 tcl_platform(byteOrder)     = bigEndian
 tcl_platform(host_platform) = unix
 tcl_platform(machine)       = PowerPC
 tcl_platform(os)            = OS/400
 tcl_platform(osVersion)     = V5R1M0
 tcl_platform(platform)      = java

QNX 6.3.0
 tcl_platform(byteOrder) = littleEndian
 tcl_platform(machine)   = x86pc
 tcl_platform(os)        = QNX
 tcl_platform(osVersion) = 6.3.0
 tcl_platform(platform)  = unix

Usage tip: it's probably a mistake to "switch $::tcl_platform(os) ..." If you're having to distinguish different flavors of Unix or Windows from each other, you're likely better off determining the availability of the functionality you truly want, rather than trying to infer it from OS variation. In the Microsoft world, for example, service packs give different NT installations features that align them with 95, 98, ... Think of how autoconf performs run-time tests, rather than switching on uname.

For Tk since 8.4.2 there is also [tk windowingsystem], which tells you whether your Tk port is "win32", "x11", "aqua" or (MacOS) "classic". For UI issues that's better than asking for $tcl_platform(platform) and/or $tcl_platform(os), especially on MacOS X, where you have "aqua" as well as "x11" on the very same platform.

Note, the debug variable apparently is only available on Windows platforms when the Tcl library itself was compiled with the --enable-symbols flag.

There's a separate page called Generating a generic platform name, for discussion on how to massage the above information into a name which can be used as dirname to disambiguate shared libraries, etc.

Also potentially useful is the getWindowsAPIVendor proc which, on Windows, provides info regarding whether your underlying platform is Microsoft Windows, Wine or ReactOS.

[daneyul] - 2010-03-18 15:37:42

Last I checked, Windows 7 is no longer pre-release. Any one have any info on the codes returned by Win 7 32, 64, for the different versions (Home Premium, Ultimate, Pro) for those who don't have Win 7 systems at hand?

[JoGusto] - 2014-01-03

Win 7 Ultimate running Tcl 8.5 64-bit returns this:
   tcl_platform(byteOrder)   = littleEndian
   tcl_platform(machine)     = amd64
   tcl_platform(os)          = Windows NT
   tcl_platform(osVersion)   = 6.1
   tcl_platform(platform)    = windows
   tcl_platform(pointerSize) = 8
   tcl_platform(threaded)    = 1
   tcl_platform(wordSize)    = 4

(AFAIK, Win 7 Ultimate, Professional, etc, all return the same Windows version information for (os) and (osVersion))

AMG: Since Microsoft has chosen to use the LLP64 model for 64-bit Windows, $tcl_platform(wordSize) is 4 on both 32- and 64-bit platforms. Hardly useful. Thankfully, we have $tcl_platform(pointerSize) and $tcl_platform(machine) to disambiguate.

For my application, I'd like to know the rules of the platform (actually, the compiler used to build Tcl) for alignment and size of various C types.

Is a double aligned on a 4- or 8-byte boundary? 32- and 64-bit Linux disagree on this point (unless you use -malign-double), though I think 32- and 64-bit Windows both use 8-byte boundaries, at least when using MSVC.