> Hi,
> I'm having some trouble shutting down TCL embedded in a DLL (on
> WinXP). The function below blows up on the second printf. For some
> reason after calling Tcl_Finalize, I always get the error "Library
> function error(return value == -1 {0xffffffff}). Bad File Handle
> If I comment out the printf... I still get the same error on the very
> next printf I encounter
> int __stdcall ShutDown(void) {
> int ret;
> ret = printf ("Deleting instance of TCL Interpreter\n");
> Tcl_DeleteInterp(myInterpreter);
> Tcl_Finalize();
> ret = printf("Unloading TCL Library: %#X\n", hTCLModule);
> FreeLibrary(hTCLModule);
> return 0;
> }
> Jon
One of the things Tcl_Finalize does is closing open channels You could move the printf line to above the Tcl_Finalize.