[project @ 2005-04-12 16:40:16 by krasimir]
[ghc-hetmet.git] / ghc / compiler / ghci / Linker.lhs
index 4ebbc8b..c971f91 100644 (file)
@@ -43,6 +43,7 @@ import Outputable
 import Panic            ( GhcException(..) )
 import Util             ( zipLazy, global )
 import StaticFlags     ( v_Ld_inputs )
+import ErrUtils         ( debugTraceMsg )
 
 -- Standard libraries
 import Control.Monad   ( when, filterM, foldM )
@@ -615,16 +616,17 @@ unload :: DynFlags -> [Linkable] -> IO ()
 
 unload dflags linkables
   = block $ do -- block, so we're safe from Ctrl-C in here
+  
+       -- Initialise the linker (if it's not been done already)
+       initDynLinker dflags
 
        pls     <- readIORef v_PersistentLinkerState
        new_pls <- unload_wkr dflags linkables pls
        writeIORef v_PersistentLinkerState new_pls
 
-               let verb = verbosity dflags
-               when (verb >= 3) $ do
-           hPutStrLn stderr (showSDoc
+       debugTraceMsg dflags 3 (showSDoc
                (text "unload: retaining objs" <+> ppr (objs_loaded new_pls)))
-           hPutStrLn stderr (showSDoc
+       debugTraceMsg dflags 3 (showSDoc
                (text "unload: retaining bcos" <+> ppr (bcos_loaded new_pls)))
 
                return ()