diff options
-rw-r--r-- | generic/tclLoad.c | 25 | ||||
-rw-r--r-- | tests/pkgMkIndex.test | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 7ea1ebd..ee1862d 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -544,7 +544,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: @@ -764,6 +764,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, @@ -884,11 +901,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--; @@ -917,7 +932,7 @@ UnloadLibrary( code = TCL_OK; if (libraryPtr->safeInterpRefCount <= 0 && libraryPtr->interpRefCount <= 0 - && !keepLibrary) { + && (unloadProc != NULL) && !keepLibrary) { /* * Unload the shared library from the application memory... */ diff --git a/tests/pkgMkIndex.test b/tests/pkgMkIndex.test index 62bd3d4..25840c6 100644 --- a/tests/pkgMkIndex.test +++ b/tests/pkgMkIndex.test @@ -591,7 +591,7 @@ test pkgMkIndex-10.2 {package in DLL hidden by -load} [list exec $dll] { "[list pkg_mkIndex -lazy -load Pkg* $fullPkgPath [file tail $x]]" exec [interpreter] << $script pkgtest::runCreatedIndex {0 {}} -lazy -load Pkg* -- $fullPkgPath pkga[info sharedlibextension] -} "0 {{pkga:1.0 {tclPkgSetup {pkga[info sharedlibextension] load {pkga_eq pkga_quote}}}}}" +} "0 {}" if {[testConstraint $dll]} { file delete -force [file join $fullPkgPath [file tail $x]] |