summaryrefslogtreecommitdiffstats
path: root/generic/tclLoad.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-22 17:25:15 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-22 17:25:15 (GMT)
commit401229c959cd2f8b13524d085db2ba76f3384e31 (patch)
tree76eb6b8b51d9bda6884357c2a9f385556ca20324 /generic/tclLoad.c
parentb39c277e12e6135a57caca867bb94569bd4bbb10 (diff)
parentdf95b68753a5b8b52e240d6dd95bd69bce9607af (diff)
downloadtcl-401229c959cd2f8b13524d085db2ba76f3384e31.zip
tcl-401229c959cd2f8b13524d085db2ba76f3384e31.tar.gz
tcl-401229c959cd2f8b13524d085db2ba76f3384e31.tar.bz2
Merge 8.7
Diffstat (limited to 'generic/tclLoad.c')
-rw-r--r--generic/tclLoad.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index cca5b7a..88f4724 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -536,7 +536,7 @@ Tcl_LoadObjCmd(
*
* Tcl_UnloadObjCmd --
*
- * This function is invoked to process the "unload" Tcl command. See the
+ * Implements the the "unload" Tcl command. See the
* user documentation for details on what it does.
*
* Results:
@@ -754,6 +754,23 @@ Tcl_UnloadObjCmd(
return code;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UnloadLibrary --
+ *
+ * Unloads a library from an interpreter, and also from the process if it
+ * is unloadable, i.e. if it provides an "unload" function.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See description.
+ *
+ *----------------------------------------------------------------------
+ */
static int
UnloadLibrary(
Tcl_Interp *interp,
@@ -874,11 +891,9 @@ UnloadLibrary(
}
/*
- * The unload function executed fine. Examine the reference count to see
- * if we unload the DLL.
+ * The unload function was called succesfully.
*/
-
Tcl_MutexLock(&libraryMutex);
if (Tcl_IsSafe(target)) {
libraryPtr->safeInterpRefCount--;
@@ -907,7 +922,7 @@ UnloadLibrary(
code = TCL_OK;
if (libraryPtr->safeInterpRefCount <= 0 && libraryPtr->interpRefCount <= 0
- && !keepLibrary) {
+ && (unloadProc != NULL) && !keepLibrary) {
/*
* Unload the shared library from the application memory...
*/