Overview
Artifact ID: | 29783edadd73c7d65a0703114cb0942fb027c9ce |
---|---|
Page Name: | Documentation |
Date: | 2014-06-17 01:05:05 |
Original User: | rkeene |
Mimetype: | text/x-markdown |
Next | 606bbdc6eef7115f70e609e960f750475a68ad58 |
Content
Manual Page
package require tcc4tcl
tcc4tcl::cproc
Creates a Tcl procedure that calls C code.
Synopsis:
tcc4tcl::cproc <procName> <argList> <returnType> <code>
<procName>
is the name of the Tcl procedure to create<argList>
is a list of arguments and their types for the C function;- The list is in the format of: type1 name1 type2 name2 ... typeN nameN
- The supported types are:
- Tcl_Interp*
- int
- long
- float
- double
- char*
- Tcl_Obj*
- void*
<returnType>
is the return type for the C function- The supported types are:
- void: No return value
- ok: Return TCL_OK or TCL_ERROR
- int
- long
- float
- double
- char*: TCL_STATIC string (immutable from C)
- string, dstring: TCL_DYNAMIC string (mutable from C)
- vstring: TCL_VOLATILE string (mutable from C)
- default: Tcl_Obj*, a Tcl Object
<code>
is the C code that comprises the function
Example:
tcc4tcl::cproc add {int a int b} { return(a+b); }