NAME

Tcl_AppInit - Perform application-specific initialization

SYNOPSIS

#include <tcl.h>

Tcl_AppInit(interp)

ARGUMENTS

Tcl_Interp *interp (in)
Interpreter for the application.

DESCRIPTION

Tcl_AppInit is a procedure that is invoked by the main programs for Tcl applications such as tclsh and wish. Its purpose is to allow new Tcl applications to be created without modifying existing main programs such as those for tclsh and wish. To create a new application simply write a new version of Tcl_AppInit to replace the default version provided by Tcl, then link your new Tcl_AppInit with the Tcl library, which contains the main program from tclsh (be sure to specify the switch ``-u _main'' to the linker to force it to use the version of main from the Tcl library).

Tcl_AppInit is invoked after other initialization in main and before entering the main loop to process commands. Here are some examples of things that Tcl_AppInit might do:

  1. Call initialization procedures for various packages used by the application. Each initialization procedure adds new commands to interp for its package and performs other package-specific initialization.
  2. Process command-line arguments, which can be accessed from the Tcl variables argv and argv0 in interp.
  3. Invoke a startup script to initialize the application.

KEYWORDS

application, argument, command, initialization, interpreter
Copyright © 1993 The Regents of the University of California.
Copyright © 1994 Sun Microsystems, Inc.
Copyright © 1995 Roger E. Critchlow Jr.