Whilst Tcl provides the tcl_platform array for identifying the current architecture (in particular, the platform and machine elements) this is not always sufficient. This is because (on Unix machines) tcl_platform reflects the values returned by the uname command and these are not standardized across platforms and architectures. In addition, on at least one platform (AIX) the tcl_platform(machine) contains the CPU serial number.
Consequently, individual applications need to manipulate the values in tcl_platform (along with the output of system specific utilities) - which is both inconvenient for developers, and introduces the potential for inconsistencies in identifying architectures and in naming conventions.
The platform package prevents such fragmentation - i.e., it establishes a standard naming convention for architectures running Tcl and makes it more convenient for developers to identify the current architecture a Tcl program is running on.
package require platform # Assume that app script is .../theapp/bin/theapp.tcl set binDir [file dirname [file normalize [info script]]] set libDir [file join $binDir .. lib] set platLibDir [file join $libDir [platform::identify]] load [file join $platLibDir support[info sharedlibextension]]
Copyright © 2006 ActiveState Software Inc
Licensed under Tcl/Tk terms
https://www.tcl.tk/man/tcl/TclCmd/platform.htm