Diff

Differences From Artifact [8b959926b0]:

To Artifact [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