title: How to use C++/TCL and C++/TK at the same time, in the same program?
body: <p>So it is great of <a href="http://cpptcl.sourceforge.net/" rel="nofollow noreferrer">C++/TCL</a> to provide us with easy manageable in TCL C++ functions and classes via APIs like:</p>
  
  <pre><code>#include "cpptcl.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  using namespace Tcl;
  void hello()
  {
       cout &lt;&lt; "Hello C++/Tcl!" &lt;&lt; endl;
  }
  int main()
  {
       interpreter i;
       i.def("hello", hello);
       string script = "for {set i 0} {$i != 4} {incr i} { hello }";
       i.eval(script);
  }
  </code></pre>
  
  <p>At he same time its great to have an system event loop handled in <a href="http://cpptk.sourceforge.net/" rel="nofollow noreferrer">C++/Tk</a> with api's like</p>
  
  <pre><code>#include &lt;string&gt;
  #include "cpptk.h"
  
  int main(int argc, char *argv[])
  {
      std::string script = 
          "package require Tcl 8.5\n"
          "package require Tk 8.5\n"
          "ttk::button \".b\" -text \"Say Hello\"\n"
          "pack \".b\" -padx 20 -pady 6\n"
          ;
      Tk::details::Expr(script, true);
      Tk::runEventLoop();
  }
  </code></pre>
  
  <p>So as you can see one is great for API creation another for GUI rendering.</p>
  
  <p>I want to find a way to mix them to have for example such code working:</p>
  
  <pre><code>#include "cpptcl.h"
  #include "cpptk.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  using namespace Tcl;
  void hello()
  {
       cout &lt;&lt; "Hello C++/Tcl!" &lt;&lt; endl;
  }
  int main()
  {
       interpreter i;
       i.def("hello", hello);
       string script = 
          "package require Tcl 8.5\n"
          "package require Tk 8.5\n"
          "ttk::button \".b\" -text \"Say Hello\" -command hello \n"
          "pack \".b\" -padx 20 -pady 6\n"
          ;
      Tk::details::Expr(script, true);
      Tk::runEventLoop();
  }
  </code></pre>
  
  <p>How to do such thing possible? How to mix C++/TCL and C++/Tk?</p>
  
  <p><strong><em>Updete:</em></strong></p>
  
  <p>And so we have done it. Required some CPP/TCL and CPP/Tk sorurce code fixing, see <a href="http://cloudobserver.googlecode.com/svn/trunk/CloudClient/src/3rdparty/" rel="nofollow noreferrer">our svn</a>, and <a href="https://stackoverflow.com/questions/6587082/how-to-use-c-tcl-and-c-tk-at-the-same-time-in-the-same-programm/6589766#6589766">my answer for example of use</a>.</p>