Use another language to call a function: Difference between revisions

Line 174:
===‘In’ Parameters===
To connect a function to Tcl that passes an arbitrary C string as input, you'd use a short C thunk, like this:
<lang tclc>int Query (char * Data, size_t * Length) {
Tcl_Obj *arguments[2];
int code;
Line 201:
return 1;
}</lang>
 
===‘Out’ Parameters===
However, in the specific case of writing to a user-specified buffer (an “out” parameter) the thunk code would instead manage copying the result from the interpreter back to the buffer: