Overview
Comment: | Added support for a ClientData type |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
633a01c5d6e01f115a0e267f9557ac40 |
User & Date: | rkeene on 2016-01-25 18:18:24 |
Other Links: | manifest | tags |
Context
2016-01-25
| ||
18:31 | Added support for a ClientData type check-in: 91b1a5ba3d user: rkeene tags: trunk | |
18:18 | Added support for a ClientData type check-in: 633a01c5d6 user: rkeene tags: trunk | |
18:09 | Updated to respect --prefix check-in: 4395e6083a user: rkeene tags: trunk | |
Changes
Modified test.tcl from [8b959926b0] to [da5a97590a].
103
104
105
106
107
108
109
110
111
112
113
114
115
116
...
178
179
180
181
182
183
184
|
# 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/lib/x86_64-linux-gnu
$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
................................................................................
}
$handle cproc callToTclBinaryWrapper {} void {
callToTclBinary("test\x00test", 9);
}
puts [$handle code]
$handle go
callToTclBinaryWrapper
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# 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_include_path [::tcl::pkgconfig get includedir,runtime] $handle add_library_path [::tcl::pkgconfig get libdir,runtime] $handle add_library_path /usr/lib/x86_64-linux-gnu $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 ................................................................................ } $handle cproc callToTclBinaryWrapper {} void { callToTclBinary("test\x00test", 9); } puts [$handle code] $handle go callToTclBinaryWrapper set handle [tcc4tcl::new] $handle cproc testClientData {int y} {int} [concat "int x = 3;" { return(x + y); }] $handle go set testVal [testClientData 1] if {$testVal != "4"} { error "\[ClientData\] Invalid value: $testVal, should have been 4" } set handle [tcc4tcl::new] $handle cproc testClientData {ClientData _x=3 int y} {int} { int x Tcl_GetIntFromObj(NULL, _x, &x); return(x + y); } set testVal [testClientData 1] if {$testVal != "4"} { error "\[ClientData\] Invalid value: $testVal, should have been 4" } exit 0 |