Overview
Comment: | Added a test using "curl" as a baseline for linking in external functions and libraries |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2bc3e54e9e9b17bac2f8af52889267d0 |
User & Date: | rkeene on 2014-06-22 23:40:15 |
Other Links: | manifest | tags |
Context
2014-06-23
| ||
00:54 | Added Tcl_WideInt support check-in: 60d4d528a0 user: rkeene tags: trunk | |
2014-06-22
| ||
23:40 | Added a test using "curl" as a baseline for linking in external functions and libraries check-in: 2bc3e54e9e user: rkeene tags: trunk | |
23:23 | Fixed issues with several subcommands check-in: 05cac27666 user: rkeene tags: trunk | |
Changes
Modified tcc4tcl.tcl from [f5126bcd41] to [64ae92f63e].
83 83 84 84 lappend state(add_lib) {*}$args 85 85 } 86 86 87 87 proc _cproc {handle name adefs rtype {body "#"}} { 88 88 upvar #0 $handle state 89 89 90 - set wrap [::tcc4tcl::wrap $name $adefs $rtype $body] 90 + set wrap [uplevel 1 [list ::tcc4tcl::wrap $name $adefs $rtype $body]] 91 91 92 92 set wrapped [lindex $wrap 0] 93 93 set wrapper [lindex $wrap 1] 94 94 set tclname [lindex $wrap 2] 95 95 96 96 append state(code) $wrapped "\n" 97 97 append state(code) $wrapper "\n" ................................................................................ 321 321 322 322 # Create wrapped function 323 323 if {$body ne "#"} { 324 324 append code "static $rtype2 ${cname}([join $cargs {, }]) \{\n" 325 325 append code $body 326 326 append code "\}\n" 327 327 } else { 328 - append code "#define $cname $name" "\n" 328 + append code "#define $cname [namespace tail $name]" "\n" 329 329 } 330 330 331 331 # Create wrapper function 332 332 ## Supported input types 333 333 ## Tcl_Interp* 334 334 ## int 335 335 ## long
Modified test.tcl from [271d570bc1] to [cd217a385a].
65 65 # New API 66 66 set handle [tcc4tcl::new] 67 67 $handle cproc test5 {int i} int { return(i + 42); } 68 68 if {[$handle code] == ""} { 69 69 error "[list $handle code] did not give code output" 70 70 } 71 71 $handle cproc test6 {int i} int { return(i + 42); } 72 -$handle add_library_path . 73 72 $handle go 74 73 puts [test5 1] 75 74 puts [test6 1] 75 + 76 +set handle [tcc4tcl::new] 77 +$handle ccode {const char *curl_version(void);} 78 +$handle cproc curl_version {} char* 79 +$handle add_library_path /usr/lib64 80 +$handle add_library_path /usr/lib 81 +$handle add_library curl 82 +$handle go 83 +puts [curl_version] 84 + 85 +set handle [tcc4tcl::new] 86 +$handle delete