diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-04-06 13:05:44 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-04-06 13:05:44 (GMT) |
commit | a6cc2f3c23ebe5374eabe590cb06cb4c4b419dbc (patch) | |
tree | ee0613bd7e8d75ba4fd80811c1b4aac49b00d308 /win/tclWinLoad.c | |
parent | 5e4e04d0e675c6fa2f437398bcdcab674c0cbd04 (diff) | |
download | tcl-a6cc2f3c23ebe5374eabe590cb06cb4c4b419dbc.zip tcl-a6cc2f3c23ebe5374eabe590cb06cb4c4b419dbc.tar.gz tcl-a6cc2f3c23ebe5374eabe590cb06cb4c4b419dbc.tar.bz2 |
More generation of error codes (most platform-specific parts not already using
Tcl_PosixError).
Diffstat (limited to 'win/tclWinLoad.c')
-rw-r--r-- | win/tclWinLoad.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index e877ebe..3f4d4d9 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -125,20 +125,27 @@ TclpDlopen( switch (lastError) { case ERROR_MOD_NOT_FOUND: + Tcl_SetErrorCode(interp, "WIN_LOAD", "MOD_NOT_FOUND", NULL); + goto notFoundMsg; case ERROR_DLL_NOT_FOUND: + Tcl_SetErrorCode(interp, "WIN_LOAD", "DLL_NOT_FOUND", NULL); + notFoundMsg: Tcl_AppendResult(interp, "this library or a dependent library" " could not be found in library path", NULL); break; case ERROR_PROC_NOT_FOUND: + Tcl_SetErrorCode(interp, "WIN_LOAD", "PROC_NOT_FOUND", NULL); Tcl_AppendResult(interp, "A function specified in the import" " table could not be resolved by the system. Windows" " is not telling which one, I'm sorry.", NULL); break; case ERROR_INVALID_DLL: + Tcl_SetErrorCode(interp, "WIN_LOAD", "INVALID_DLL", NULL); Tcl_AppendResult(interp, "this library or a dependent library" " is damaged", NULL); break; case ERROR_DLL_INIT_FAILED: + Tcl_SetErrorCode(interp, "WIN_LOAD", "DLL_INIT_FAILED", NULL); Tcl_AppendResult(interp, "the library initialization" " routine failed", NULL); break; @@ -147,14 +154,18 @@ TclpDlopen( Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL); } return TCL_ERROR; - } else { - handlePtr = ckalloc(sizeof(struct Tcl_LoadHandle_)); - handlePtr->clientData = (ClientData) hInstance; - handlePtr->findSymbolProcPtr = &FindSymbol; - handlePtr->unloadFileProcPtr = &UnloadFile; - *loadHandle = handlePtr; - *unloadProcPtr = &UnloadFile; } + + /* + * Succeded; package everything up for Tcl. + */ + + handlePtr = ckalloc(sizeof(struct Tcl_LoadHandle_)); + handlePtr->clientData = (ClientData) hInstance; + handlePtr->findSymbolProcPtr = &FindSymbol; + handlePtr->unloadFileProcPtr = &UnloadFile; + *loadHandle = handlePtr; + *unloadProcPtr = &UnloadFile; return TCL_OK; } @@ -344,7 +355,7 @@ TclpTempFileNameForLibrary(Tcl_Interp* interp, /* Tcl interpreter */ } if (dllDirectoryName == NULL) { Tcl_AppendResult(interp, "couldn't create temporary directory: ", - Tcl_PosixError(interp), NULL); + Tcl_PosixError(interp), NULL); } fileName = TclpNativeToNormalized(dllDirectoryName); tail = TclPathPart(interp, path, TCL_PATH_TAIL); |