Rev | Line | |
---|
[25] | 1 | # findBadExternals.tcl -- |
---|
| 2 | # |
---|
| 3 | # This script scans the Tcl load library for exported symbols |
---|
| 4 | # that do not begin with 'Tcl' or 'tcl'. It reports them on the |
---|
| 5 | # standard output. It is used to make sure that the library does |
---|
| 6 | # not inadvertently export externals that may be in conflict with |
---|
| 7 | # other code. |
---|
| 8 | # |
---|
| 9 | # Usage: |
---|
| 10 | # |
---|
| 11 | # tclsh findBadExternals.tcl /path/to/tclXX.so-or-.dll |
---|
| 12 | # |
---|
| 13 | # Copyright (c) 2005 George Peter Staplin and Kevin Kenny |
---|
| 14 | # |
---|
| 15 | # See the file "license.terms" for information on usage and redistribution |
---|
| 16 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 17 | # |
---|
| 18 | # RCS: @(#) $Id: findBadExternals.tcl,v 1.1 2005/11/04 19:37:57 kennykb Exp $ |
---|
| 19 | # |
---|
| 20 | #---------------------------------------------------------------------- |
---|
| 21 | |
---|
| 22 | proc main {argc argv} { |
---|
| 23 | |
---|
| 24 | if {$argc != 1} { |
---|
| 25 | puts stderr "syntax is: [info script] libtcl" |
---|
| 26 | return 1 |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | switch -exact -- $::tcl_platform(platform) { |
---|
| 31 | unix - |
---|
| 32 | macosx { |
---|
| 33 | set status [catch { |
---|
| 34 | exec nm --extern-only --defined-only [lindex $argv 0] |
---|
| 35 | } result] |
---|
| 36 | } |
---|
| 37 | windows { |
---|
| 38 | set status [catch { |
---|
| 39 | exec dumpbin /exports [lindex $argv 0] |
---|
| 40 | } result] |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | if {$status != 0 && $::errorCode ne "NONE"} { |
---|
| 44 | puts $result |
---|
| 45 | return 1 |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | foreach line [split $result \n] { |
---|
| 49 | if {! [string match {* [Tt]cl*} $line]} { |
---|
| 50 | puts $line |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | return 0 |
---|
| 55 | } |
---|
| 56 | exit [main $::argc $::argv] |
---|
Note: See
TracBrowser
for help on using the repository browser.