diff --git a/clash-ghc/src-bin-861/Clash/GHCi/UI.hs b/clash-ghc/src-bin-861/Clash/GHCi/UI.hs index 80c4ec6957..ee98f98a0e 100644 --- a/clash-ghc/src-bin-861/Clash/GHCi/UI.hs +++ b/clash-ghc/src-bin-861/Clash/GHCi/UI.hs @@ -69,6 +69,8 @@ import qualified Lexer import StringBuffer import Outputable hiding ( printForUser, printForUserPartWay ) +import DynamicLoading ( initializePlugins ) + -- Other random utilities import BasicTypes hiding ( isTopLevel ) import Digraph @@ -2834,7 +2836,10 @@ newDynFlags interactive_only minus_opts = do when (interactive_only && packageFlagsChanged idflags1 idflags0) $ do liftIO $ hPutStrLn stderr "cannot set package flags with :seti; use :set" - GHC.setInteractiveDynFlags idflags1 + -- Load any new plugins + hsc_env0 <- GHC.getSession + idflags2 <- liftIO (initializePlugins hsc_env0 idflags1) + GHC.setInteractiveDynFlags idflags2 installInteractivePrint (interactivePrint idflags1) False dflags0 <- getDynFlags diff --git a/clash-ghc/src-bin-861/Clash/Main.hs b/clash-ghc/src-bin-861/Clash/Main.hs index 30266e9b80..2cbe2cd879 100644 --- a/clash-ghc/src-bin-861/Clash/Main.hs +++ b/clash-ghc/src-bin-861/Clash/Main.hs @@ -59,6 +59,7 @@ import Util import Panic import UniqSupply import MonadUtils ( liftIO ) +import DynamicLoading ( initializePlugins ) -- Imports for --abi-hash import LoadIface ( loadUserInterface ) @@ -298,8 +299,8 @@ main' postLoadMode dflags0 args flagWarnings clashOpts = do DoMake -> doMake srcs DoMkDependHS -> doMkDependHS (map fst srcs) StopBefore p -> liftIO (oneShot hsc_env p srcs) - DoInteractive -> ghciUI clashOpts srcs Nothing - DoEval exprs -> ghciUI clashOpts srcs $ Just $ reverse exprs + DoInteractive -> ghciUI clashOpts hsc_env dflags6 srcs Nothing + DoEval exprs -> ghciUI clashOpts hsc_env dflags6 srcs $ Just $ reverse exprs DoAbiHash -> abiHash (map fst srcs) ShowPackages -> liftIO $ showPackages dflags6 DoFrontend f -> doFrontend f srcs @@ -310,11 +311,14 @@ main' postLoadMode dflags0 args flagWarnings clashOpts = do liftIO $ dumpFinalStats dflags6 -ghciUI :: IORef ClashOpts -> [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc () +ghciUI :: IORef ClashOpts -> HscEnv -> DynFlags -> [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc () #if !defined(GHCI) -ghciUI _ _ _ = throwGhcException (CmdLineError "not built for interactive use") +ghciUI _ _ _ _ _ = throwGhcException (CmdLineError "not built for interactive use") #else -ghciUI opts = interactiveUI (defaultGhciSettings opts) +ghciUI opts hsc_env dflags0 srcs maybe_expr = do + dflags1 <- liftIO (initializePlugins hsc_env dflags0) + _ <- GHC.setSessionDynFlags dflags1 + interactiveUI (defaultGhciSettings opts) srcs maybe_expr #endif -- -----------------------------------------------------------------------------