From e5f943eb14b9d5c0ced6b67ed797d602323c43bd Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 19 Dec 2002 15:12:02 +0000 Subject: [PATCH] [project @ 2002-12-19 15:12:01 by simonmar] GHCi needs to link in packages eagerly if they're specified on the command line. --- ghc/compiler/ghci/InteractiveUI.hs | 18 +++++++++++------- ghc/compiler/ghci/Linker.lhs | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index 37f1f92..d4d994a 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,6 +1,6 @@ {-# OPTIONS -#include "Linker.h" -#include "SchedAPI.h" #-} ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.140 2002/12/19 12:49:27 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.141 2002/12/19 15:12:01 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -23,8 +23,8 @@ import MkIface ( ifaceTyThing ) import DriverFlags import DriverState import DriverUtil ( remove_spaces, handle ) -import Linker ( initLinker, showLinkerState, linkLibraries ) -import Finder ( flushFinderCache ) +import Linker ( initLinker, showLinkerState, linkLibraries, + linkPackages ) import Util import Id ( isRecordSelector, recordSelectorFieldLabel, isDataConWrapId, isDataConId, idName ) @@ -71,8 +71,6 @@ import Control.Monad as Monad import GHC.Exts ( unsafeCoerce# ) -import Foreign ( nullPtr ) -import Foreign.C.String ( CString, peekCString, withCString ) import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) import GHC.Posix ( setNonBlockingFD ) @@ -157,8 +155,13 @@ interactiveUI cmstate paths cmdline_objs = do dflags <- getDynFlags - -- packages are loaded "on-demand" now initLinker + + -- link packages requested explicitly on the command-line + expl <- readIORef v_ExplicitPackages + linkPackages dflags expl + + -- link libraries from the command-line linkLibraries dflags cmdline_objs -- Initialise buffering for the *interpreted* I/O system @@ -910,9 +913,10 @@ newPackages new_pkgs = do -- The new packages are already in v_Packages dflags <- io getDynFlags cmstate1 <- io (cmUnload (cmstate state) dflags) setGHCiState state{ cmstate = cmstate1, targets = [] } + io (linkPackages dflags new_pkgs) setContextAfterLoad [] ------------------------------------------------------------------------------ +-- --------------------------------------------------------------------------- -- code for `:show' showCmd str = diff --git a/ghc/compiler/ghci/Linker.lhs b/ghc/compiler/ghci/Linker.lhs index f766c42..a2e7b1b 100644 --- a/ghc/compiler/ghci/Linker.lhs +++ b/ghc/compiler/ghci/Linker.lhs @@ -18,7 +18,8 @@ necessary. module Linker ( HValue, initLinker, showLinkerState, linkLibraries, linkExpr, unload, extendLinkEnv, - LibrarySpec(..) + LibrarySpec(..), + linkPackages, ) where #include "../includes/config.h" -- 1.7.10.4