Adding the Interface to Tcl

To add the Empress extension to a Tcl/C application (for example, to create a Tcl shell which includes the Empress extension), the procedure Etsql_Init() should be called:
	int	Etsql_Init (Tcl_Interp *interp)
This procedure initializes the Empress package and registers a new Tcl command: etsql. It also renames the original Tcl exit command, and creates a new exit command. This new exit command will perform database clean-up before calling the original exit command.

Etsql_Init() returns TCL_OK on success, or TCL_ERROR on failure.

Note: this version of the Empress Tcl/Tk interface does not support multiple Tcl interpreters.

Example

Here's the source of tclsh modified to use the Empress interface:
	#include 
	#include 

	main	(argc, argv)
		int	argc;
		char	*argv[];
	{
		Tcl_Main (argc, argv, Tcl_AppInit);
		exit (0);
	}

	int	Tcl_AppInit (interp)
		Tcl_Interp	*interp;
	{
		int	Sql_Init();

		if (Tcl_Init (interp) == TCL_ERROR)
			return TCL_ERROR;

		if (Etsql_Init (interp) == TCL_ERROR)
			return TCL_ERROR;

		return TCL_OK;
	}