Version 7 of What 'embedding' means

Updated 2006-12-07 13:59:31


"BOOK Tricks of the Java Programming Gurus" has a chapter that illustrates the concept well.

Also see "What is 'embedding'?" [1 ].

RS: As a simple hint, you do embedding when your C code contains

 #include <tcl.h>
 Tcl_Interp *interp = NULL;

Then you can create new Tcl commands, link static variables from your C program to Tcl variables, but first of all have the power of Tcl at your fingertips ;-)

I thought there was at least one more call - to some sort of locating the encoding files, etc. function - required?

MJ - When embedding a complete Tcl install (e.g. with init.tcl) the following can be used to completely initialize the embedded Tcl interpreter (copied from TIP 66).

  Tcl_Interp * interp         ;

  /* Initialise the Tcl library thouroughly
  Tcl_FindExecutable( argv[0] ) ;

  /* Create the interp, evaluate "init.tcl" for the script
     level initialisation.
  interp = Tcl_CreateInterp() ;

  if ( Tcl_Init( interp ) != TCL_OK ) {
     ... Report the error

Category Glossary