Update of "Documentation"
Overview

Artifact ID: 75ea53a7c199dcb325993054472d455010743be6
Page Name:Documentation
Date: 2014-06-17 05:14:55
Original User: rkeene
Mimetype:text/x-markdown
Parent: 6510a3168ed2b29e2d2673e89315affef19d3fcd (diff)
Next 82079e5d71154f43f132e47ec8736e91697f4666
Content

Manual Page

package require tcc4tcl

tcc4tcl::cproc

Creates a Tcl procedure that calls C code.

Synopsis:

  1. tcc4tcl::cproc <procName> <argList> <returnType> <code>
    1. <procName> is the name of the Tcl procedure to create
    2. <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
      2. The supported types are:
        1. Tcl_Interp*: Must be first argument, will be the interpreter
        2. int
        3. long
        4. float
        5. double
        6. char*
        7. Tcl_Obj*: Passes the Tcl object in unchanged
        8. void*
    3. <returnType> is the return type for the C function
      1. The supported types are:
        1. void: No return value
        2. ok: Return TCL_OK or TCL_ERROR
        3. int
        4. long
        5. float
        6. double
        7. char*: TCL_STATIC string (immutable from C)
        8. string, dstring: TCL_DYNAMIC string (mutable from C)
        9. vstring: TCL_VOLATILE string (mutable from C)
        10. default: Tcl_Obj*, a Tcl Object
    4. <code> is the C code that comprises the function

Example:

  1. Create a Tcl procedure called "add" which accepts 2 integers (a, b) and returns a long:
    1. tcc4tcl::cproc add {int a int b} long { return(a+b); }

tcc4tcl::ccode

tcc4tcl::cdata