30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
-
+
|
$handle cproc
-------------
Creates a Tcl procedure that calls C code.
Synoposis:
$handle cproc <procName> <argList> <returnType> <code>
$handle cproc <procName> <argList> <returnType> ?<code>?
1. `<procName>` is the name of the Tcl procedure to create
1. `<argList>` is a list of arguments and their types for the C function;
1. The list is in the format of: type1 name1 type2 name2 ... typeN nameN
1. The supported types are:
1. Tcl_Interp*: Must be first argument, will be the interpreter and the user will not need to pass this parameter
1. int
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
-
+
|
1. long
1. float
1. double
1. char*: TCL\_STATIC string (immutable from C -- use this for constants)
1. string, dstring: return a (char*) that is a TCL\_DYNAMIC string (allocated from Tcl\_Alloc, will be managed by Tcl)
1. vstring: return a (char*) that is a TCL\_VOLATILE string (mutable from C, will be copied be Tcl -- use this for local variables)
1. default: Tcl\_Obj*, a Tcl Object
1. `<code>` is the C code that comprises the function
1. `<code>` is the C code that comprises the function. If the `<code>` argument is omitted it is assumed there is already an implementation (with the name specified as `<procName>`, minus any namespace declarations) and this just creates the wrapper and Tcl command.
$handle ccode
-------------
Compile arbitrary C code.
Synopsis:
|