Version 3 of Critcl Examples

Updated 2005-12-13 19:55:44

LV: Has anyone investigated making use of Critcl to create an HTML rendering widget, perhaps based on BrowseX?

JCW: Yep, Tkhtml can be built with Critcl, though it's tricky. See [L1 ], now in critlib.


Has someone looked at http://root.cern.ch/root/Cint.html

as a possible way to integrate C with Tcl without having to compile C...

SWT: I have built a working cint shared lib for tcl. It works great! Now to "run" c code the cint library is only needed for each platform that support is required for.


Brian Theado 17Dec2004 - Examples with Tcl_Obj* return type

The presence of Tcl_IncrRefCount is crucial here and nothing gets returned without it. I guess Critcl automatically decrements the reference count on this return type. Could someone provide a counter example where the automatic reference count decrement is useful?

 package require critcl
 critcl::cproc abc {} Tcl_Obj* {
    char test[4] = "abc";
    Tcl_Obj * rv = Tcl_NewStringObj ("abc", 3);
    Tcl_IncrRefCount (rv);
    return rv;
 }
 critcl::cproc 123 {} Tcl_Obj* {
    char test[3] = {1, 2, 3};
    Tcl_Obj * obj = Tcl_NewByteArrayObj (test, 3);
    Tcl_IncrRefCount (obj);
    return obj;
 }
 puts [abc]
 binary scan [123] H* result
 puts $result

Output:

 abc
 010203

2005-09-02 Sarnold See also Critcl example with the Mancala game and foriter - a loop command.


Category Critcl