Index: tcc4tcl.tcl ================================================================== --- tcc4tcl.tcl +++ tcc4tcl.tcl @@ -85,11 +85,11 @@ } proc _cproc {handle name adefs rtype {body "#"}} { upvar #0 $handle state - set wrap [::tcc4tcl::wrap $name $adefs $rtype $body] + set wrap [uplevel 1 [list ::tcc4tcl::wrap $name $adefs $rtype $body]] set wrapped [lindex $wrap 0] set wrapper [lindex $wrap 1] set tclname [lindex $wrap 2] @@ -323,11 +323,11 @@ if {$body ne "#"} { append code "static $rtype2 ${cname}([join $cargs {, }]) \{\n" append code $body append code "\}\n" } else { - append code "#define $cname $name" "\n" + append code "#define $cname [namespace tail $name]" "\n" } # Create wrapper function ## Supported input types ## Tcl_Interp* Index: test.tcl ================================================================== --- test.tcl +++ test.tcl @@ -67,9 +67,20 @@ $handle cproc test5 {int i} int { return(i + 42); } if {[$handle code] == ""} { error "[list $handle code] did not give code output" } $handle cproc test6 {int i} int { return(i + 42); } -$handle add_library_path . $handle go puts [test5 1] puts [test6 1] + +set handle [tcc4tcl::new] +$handle ccode {const char *curl_version(void);} +$handle cproc curl_version {} char* +$handle add_library_path /usr/lib64 +$handle add_library_path /usr/lib +$handle add_library curl +$handle go +puts [curl_version] + +set handle [tcc4tcl::new] +$handle delete