︙ | | | ︙ | |
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
set handle [tcc4tcl::new]
$handle delete
# External functions
if {[info exists ::env(TCC4TCL_TEST_RUN_NATIVE)]} {
set handle [tcc4tcl::new]
$handle cwrap curl_version {} vstring
$handle add_library_path /usr/lib64
$handle add_library_path /usr/lib
$handle add_library_path /usr/lib32
$handle add_library curl
$handle go
puts [curl_version]
}
|
>
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
set handle [tcc4tcl::new]
$handle delete
# External functions
if {[info exists ::env(TCC4TCL_TEST_RUN_NATIVE)]} {
set handle [tcc4tcl::new]
$handle cwrap curl_version {} vstring
$handle add_library_path [::tcl::pkgconfig get libdir,runtime]
$handle add_library_path /usr/lib64
$handle add_library_path /usr/lib
$handle add_library_path /usr/lib32
$handle add_library curl
$handle go
puts [curl_version]
}
|
︙ | | | ︙ | |
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# Produce a loadable object
## Currently doesn't work on Darwin
if {[info exists ::env(TCC4TCL_TEST_RUN_NATIVE)] && $::tcl_platform(os) != "Darwin"} {
set tmpfile "/tmp/DELETEME_tcc4tcl_test_exec[expr rand()].so"
file delete $tmpfile
set handle [tcc4tcl::new $tmpfile "myPkg 0.1"]
$handle cproc ext_add {int a int b} long { return(a+b); }
$handle add_library_path /usr/lib64
$handle add_library_path /usr/lib
$handle add_library_path /usr/lib32
$handle add_library tclstub${::tcl_version}
$handle go
load $tmpfile myPkg
puts [ext_add 1 42]
|
>
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# Produce a loadable object
## Currently doesn't work on Darwin
if {[info exists ::env(TCC4TCL_TEST_RUN_NATIVE)] && $::tcl_platform(os) != "Darwin"} {
set tmpfile "/tmp/DELETEME_tcc4tcl_test_exec[expr rand()].so"
file delete $tmpfile
set handle [tcc4tcl::new $tmpfile "myPkg 0.1"]
$handle cproc ext_add {int a int b} long { return(a+b); }
$handle add_library_path [::tcl::pkgconfig get libdir,runtime]
$handle add_library_path /usr/lib64
$handle add_library_path /usr/lib
$handle add_library_path /usr/lib32
$handle add_library tclstub${::tcl_version}
$handle go
load $tmpfile myPkg
puts [ext_add 1 42]
|
︙ | | | ︙ | |
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
curl_easy_setopt(handle, CURLOPT_URL, url);
curl_easy_perform(handle);
return(TCL_OK);
}
$handle add_include_path /usr/include
$handle add_library_path /usr/lib64
$handle add_library_path /usr/lib
$handle add_library_path /usr/lib32
$handle add_library curl
$handle go
curl_fetch http://rkeene.org/
|
>
|
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
curl_easy_setopt(handle, CURLOPT_URL, url);
curl_easy_perform(handle);
return(TCL_OK);
}
$handle add_include_path /usr/include
$handle add_library_path [::tcl::pkgconfig get libdir,runtime]
$handle add_library_path /usr/lib64
$handle add_library_path /usr/lib
$handle add_library_path /usr/lib32
$handle add_library curl
$handle go
curl_fetch http://rkeene.org/
|
︙ | | | ︙ | |
155
156
157
158
159
160
161
162
163
164
165
166
167
|
$handle cwrap callToTcl {Tcl_Interp* ip int a int b} int
$handle go
if {[callToTcl 3 5] != 8} {
error "3 + 5 is 8, not [callToTcl 3 5]"
}
set handle [tcc4tcl::new]
$handle proc callToTcl1 {} float {
return 0.1
}
$handle cwrap callToTcl1 {} float
$handle go
puts [callToTcl1]
|
|
|
|
|
158
159
160
161
162
163
164
165
166
167
168
169
170
|
$handle cwrap callToTcl {Tcl_Interp* ip int a int b} int
$handle go
if {[callToTcl 3 5] != 8} {
error "3 + 5 is 8, not [callToTcl 3 5]"
}
set handle [tcc4tcl::new]
$handle proc callToTcl1 {int x} float {
return 0.1
}
$handle cwrap callToTcl1 {int x} float
$handle go
puts [callToTcl1 3]
|