*** tclLoad.c.orig      Fri Aug 15 16:53:10 2008
--- tclLoad.c   Wed Aug 13 09:44:41 2008
***************
*** 795,801 ****

           if (unLoadProcPtr != NULL) {
               Tcl_MutexLock(&packageMutex);
!               (*unLoadProcPtr)(pkgPtr->loadHandle);

               /*
                * Remove this library from the loaded library cache.
--- 795,803 ----

           if (unLoadProcPtr != NULL) {
               Tcl_MutexLock(&packageMutex);
!               if (pkgPtr->unloadProc != NULL) {
!                   (*unLoadProcPtr)(pkgPtr->loadHandle);
!               }

               /*
                * Remove this library from the loaded library cache.
***************
*** 1152,1158 ****

       if (pkgPtr->fileName[0] != '\0') {
           Tcl_FSUnloadFileProc *unLoadProcPtr = pkgPtr->unLoadProcPtr;
!           if (unLoadProcPtr != NULL) {
               (*unLoadProcPtr)(pkgPtr->loadHandle);
           }
       }
--- 1154,1160 ----

       if (pkgPtr->fileName[0] != '\0') {
           Tcl_FSUnloadFileProc *unLoadProcPtr = pkgPtr->unLoadProcPtr;
!           if ((unLoadProcPtr != NULL) && (pkgPtr->unloadProc != NULL)) {
               (*unLoadProcPtr)(pkgPtr->loadHandle);
           }
       }
