59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
set v 1
} err
if {$err != "" || $v == 1} {
error "\[test4\] did not return the expected error"
}
# New API
set handle [tcc4tcl::new]
$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 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
|
>
>
>
>
>
>
>
>
>
>
|
>
>
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
set v 1
} err
if {$err != "" || $v == 1} {
error "\[test4\] did not return the expected error"
}
# New API
## Simple test
set handle [tcc4tcl::new]
$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 go
puts [test5 1]
puts [test6 1]
## Delete without performing
set handle [tcc4tcl::new]
$handle delete
# External functions (requires .a files)
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]
# wide values
set handle [tcc4tcl::new]
$handle cproc wideTest {Tcl_WideInt x} Tcl_WideInt {
return(x);
}
$handle go
puts [wideTest 30]
|