Version 8 of Critcl does C++

Updated 2003-04-24 06:53:27

Early in 2003, Bill Wallace contributed a patch which makes it practical [with which version?] to write

    critcl::config language c++

Re version: see changelog at [L1 ] -jcw


But what's the point? Since Critcl is at its best coding tiny bits of what inventor JCW calls "grease", what's the advantage of C++ over C? A concrete example will probably be instructive ...


KBK Perhaps the point is that many applications, especially on Windows, export APIs that are accessible only from C++? if you're using Critcl to build a Tcl interface to one of them, you'll need something like Bill's patch.

Another use is to glue to existing libraries which have a C++ API -jcw


How does this work? Are there any examples? When i insert the above code my library will not build complains about ns_XX_Init not being found(where XX is the name of the namespace) [email protected]

24apr03 jcw - Ah, thanks for pointing this out. Turns out that you also need to add "critcl::clibraries -lstdc++". Here's an example (output is "123"):

  package require critcl

  critcl::config language c++
  critcl::clibraries -lstdc++

  critcl::ccode {
    class A {
      int value;
    public:
      A() : value (123) {}
      operator int() const { return value; }
    };
  }

  critcl::cproc tryplus {} int {
    A var;
    return var;
  }

  puts [tryplus]