From: Daniel A. S. <st...@ic...> - 2005-04-30 04:35:05
|
Zoran, On 29/04/2005, at 6:26, Zoran Vasiljevic wrote: > Concerning my latest changes: > > I (still) do not know why this could be a problem. The interp result > is cleared *only* if the underlying code returns TCL_ERROR. > So if the plafrom specific call decided to trow the exception > the result still there. Otherwise, it is wiped out. Can somebody > tell why is this problematic? Pehaps I'm overlooking something? reread what I wrote earlier: On 22/04/2005, at 16:22, Daniel A. Steffen wrote: > As mentioned, for dyld, link errors e.g. due to missing library > dependencies can only be determined in TclpFindSymbol(), i.e. > TclpDlopen() of such a library will succeed, but TclpFindSymbol() will > fail and add an error message to the interp. and note that TclpFindSymbol() does not return an tcl error code, but the address of the requested symbol; moreover, TclpFindSymbol() returning NULL is only an error for the _Init symbol, and not for the others (but this is only checked after TclLoadFile() has returned with TCL_OK) i.e. even for a library that cannot be loaded, TclLoadFile() can return TCL_OK, and only the code in Tcl_LoadObjCmd() determines the error condition. Maybe we can change the specification of TclLoadFile() to say that if it is given any symbol names, at least one of them must resolve successfully for TclLoadFile() to return TCL_OK ? if none do, it would return TCL_ERROR, as in the patch below Cheers, Daniel -- ** Daniel A. Steffen ** "And now for something completely ** Dept. of Mathematics ** different" Monty Python ** Macquarie University ** <mailto:st...@ma...> ** NSW 2109 Australia ** <http://www.maths.mq.edu.au/~steffen/> Index: tclIOUtil.c =================================================================== RCS file: /cvsroot/tcl/tcl/generic/tclIOUtil.c,v retrieving revision 1.117 diff -u -p -r1.117 tclIOUtil.c --- tclIOUtil.c 27 Apr 2005 18:48:25 -0000 1.117 +++ tclIOUtil.c 30 Apr 2005 04:31:33 -0000 @@ -3033,20 +3033,28 @@ TclLoadFile(interp, pathPtr, symc, symbo if (proc != NULL) { int retVal = (*proc)(interp, pathPtr, handlePtr, unloadProcPtr); if (retVal == TCL_OK) { - int i; + int i, res; if (*handlePtr == NULL) { return TCL_ERROR; } + res = i > 0 ? TCL_ERROR : TCL_OK; for (i = 0;i < symc;i++) { if (symbols[i] != NULL) { *procPtrs[i] = TclpFindSymbol(interp, *handlePtr, symbols[i]); + if (*procPtrs[i] != NULL) { + res = TCL_OK; + } + } else { + res = TCL_OK; } } /* Copy this across, since both are equal for the native fs */ *clientDataPtr = (ClientData)*handlePtr; - Tcl_ResetResult(interp); - return TCL_OK; + if (res == TCL_OK) { + Tcl_ResetResult(interp); + } + return res; } if (Tcl_GetErrno() != EXDEV) { return retVal; |