summaryrefslogtreecommitdiffstats
path: root/win/tclWinLoad.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinLoad.c')
-rw-r--r--win/tclWinLoad.c62
1 files changed, 32 insertions, 30 deletions
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index 3e11224..26512b1 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.c
@@ -102,37 +102,39 @@ TclpDlopen(
* better if there was a way to get what DLLs
*/
- 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_AppendToObj(errMsg, "this library or a dependent library"
- " could not be found in library path", -1);
- break;
- case ERROR_PROC_NOT_FOUND:
- Tcl_SetErrorCode(interp, "WIN_LOAD", "PROC_NOT_FOUND", NULL);
- Tcl_AppendToObj(errMsg, "A function specified in the import"
- " table could not be resolved by the system. Windows"
- " is not telling which one, I'm sorry.", -1);
- break;
- case ERROR_INVALID_DLL:
- Tcl_SetErrorCode(interp, "WIN_LOAD", "INVALID_DLL", NULL);
- Tcl_AppendToObj(errMsg, "this library or a dependent library"
- " is damaged", -1);
- break;
- case ERROR_DLL_INIT_FAILED:
- Tcl_SetErrorCode(interp, "WIN_LOAD", "DLL_INIT_FAILED", NULL);
- Tcl_AppendToObj(errMsg, "the library initialization"
- " routine failed", -1);
- break;
- default:
- TclWinConvertError(lastError);
- Tcl_AppendToObj(errMsg, Tcl_PosixError(interp), -1);
+ if (interp) {
+ 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_AppendToObj(errMsg, "this library or a dependent library"
+ " could not be found in library path", -1);
+ break;
+ case ERROR_PROC_NOT_FOUND:
+ Tcl_SetErrorCode(interp, "WIN_LOAD", "PROC_NOT_FOUND", NULL);
+ Tcl_AppendToObj(errMsg, "A function specified in the import"
+ " table could not be resolved by the system. Windows"
+ " is not telling which one, I'm sorry.", -1);
+ break;
+ case ERROR_INVALID_DLL:
+ Tcl_SetErrorCode(interp, "WIN_LOAD", "INVALID_DLL", NULL);
+ Tcl_AppendToObj(errMsg, "this library or a dependent library"
+ " is damaged", -1);
+ break;
+ case ERROR_DLL_INIT_FAILED:
+ Tcl_SetErrorCode(interp, "WIN_LOAD", "DLL_INIT_FAILED", NULL);
+ Tcl_AppendToObj(errMsg, "the library initialization"
+ " routine failed", -1);
+ break;
+ default:
+ TclWinConvertError(lastError);
+ Tcl_AppendToObj(errMsg, Tcl_PosixError(interp), -1);
+ }
+ Tcl_SetObjResult(interp, errMsg);
}
- Tcl_SetObjResult(interp, errMsg);
return TCL_ERROR;
}