Check-in [9d947ddc1d]
Overview
Comment:Updated to include Tcl runtime in lib search path
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9d947ddc1db21e305eb72150b19a614b7cf52a24
User & Date: rkeene on 2014-07-16 14:32:46
Other Links: manifest | tags
Context
2014-07-16
14:44
Updated to create a proc if we are operating in an existing interpreter, to avoid setting local variables check-in: 500057b0ea user: rkeene tags: trunk
14:32
Updated to include Tcl runtime in lib search path check-in: 9d947ddc1d user: rkeene tags: trunk
13:41
Updated to link against stubs library for current version of Tcl check-in: 15ac59fd14 user: rkeene tags: trunk
Changes

Modified test.tcl from [7be1937b09] to [907e91664c].

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]