Check-in [24cc34d5f9]
Overview
Comment:Updated to allow for the possibility of creating a DLL that is not a Tcl package
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 24cc34d5f90a4a7c7c230e0223b50bd8275b1ad6
User & Date: rkeene on 2014-06-18 18:05:59
Other Links: manifest | tags
Context
2014-06-18
19:04
Updated to use pointerSize to determine 32/64-bit library paths so that i386 code can be emitted when running a 32-bit Tcl on a 64-bit box check-in: 0d7d9afa0a user: rkeene tags: trunk
18:05
Updated to allow for the possibility of creating a DLL that is not a Tcl package check-in: 24cc34d5f9 user: rkeene tags: trunk
17:32
Fixed issue when using package versions check-in: 68ce1fca09 user: rkeene tags: trunk
Changes

Modified tcc4tcl.tcl from [16583ee9af] to [8ce88b67f0].

    23     23   
    24     24   		if {$output == ""} {
    25     25   			set type "memory"
    26     26   		} else {
    27     27   			if {$pkgName == ""} {
    28     28   				set type "exe"
    29     29   			} else {
    30         -				set type "dll"
           30  +				set type "package"
    31     31   			}
    32     32   		}
    33     33   
    34     34   		array set $handle [list tcc $tcc_handle code "" type $type filename $output package $pkgName]
    35     35   
    36     36   		proc $handle {cmd args} [string map [list @@HANDLE@@ $handle] {
    37     37   			set handle {@@HANDLE@@}
................................................................................
    79     79   		set state(code) "#include <tcl.h>\n\n$state(code)"
    80     80   
    81     81   		# Append additional generated code to support the output type
    82     82   		switch -- $state(type) {
    83     83   			"memory" {
    84     84   				# No additional code needed
    85     85   			}
    86         -			"exe" {
           86  +			"exe" - "dll" {
    87     87   				if {[info exists state(procs)] && [llength $state(procs)] > 0} {
    88     88   					append state(code) "int _initProcs(Tcl_Interp *interp) \{\n"
    89     89   					
    90     90   					foreach {procname cname} $state(procs) {
    91     91   						append state(code) "  Tcl_CreateObjCommand(interp, \"$procname\", $cname, NULL, NULL);"
    92     92   					}
    93     93   
    94     94   					append state(code) "\}"
    95     95   				}
    96     96   			}
    97         -			"dll" {
           97  +			"package" {
    98     98   				set packageName [lindex $state(package) 0]
    99     99   				set packageVersion [lindex $state(package) 1]
   100    100   				if {$packageVersion == ""} {
   101    101   					set packageVersion "0"
   102    102   				}
   103    103   
   104    104   				append state(code) "int [string totitle $packageName]_Init(Tcl_Interp *interp) \{\n"
................................................................................
   117    117   				append state(code) "Tcl_PkgProvide(interp, \"$packageName\", \"$packageVersion\");\n"
   118    118   				append state(code) "  return(TCL_OK);\n"
   119    119   				append state(code) "\}"
   120    120   			}
   121    121   		}
   122    122   
   123    123   		# Generate output code
   124         -		tcc4tcl $dir $state(type) tcc
          124  +		switch -- $state(type) {
          125  +			"package" {
          126  +				set tcc_type "dll"
          127  +			}
          128  +			default {
          129  +				set tcc_type $state(type)
          130  +			}
          131  +		}
          132  +		tcc4tcl $dir $tcc_type tcc
   125    133   
   126    134   		switch -- $state(type) {
   127    135   			"memory" {
   128    136   				tcc compile $state(code)
   129    137   
   130    138   				foreach {procname cname} $state(procs) {
   131    139   					tcc command $procname $cname
   132    140   				}
   133    141   			}
   134    142   
   135         -			"dll" - "exe" {
          143  +			"package" - "dll" - "exe" {
   136    144   				switch -glob -- $::tcl_platform(os)-$::tcl_platform(machine) {
   137    145   					"Linux-x86_64" {
   138    146   						tcc add_library_path "/lib64"
   139    147   						tcc add_library_path "/usr/lib64"
   140    148   						tcc add_library_path "/lib"
   141    149   						tcc add_library_path "/usr/lib"
   142    150   					}