Re: Error shutting down TCL



On May 31, 2:28 pm, bluemoosek...@xxxxxxxxx wrote:
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
(including stdin and stdout) This means that after a call to
Tcl_Finalize these channels are not available anymore and therefore a
printf will fail.

You could move the printf line to above the Tcl_Finalize.

Mark

.


Quantcast