HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Linker.Loader

The loader

This module deals with the top-level issues of dynamic linking (loading), calling the object-code linker and the byte-code linker where necessary.

  • 2 types
  • 18 values
  • Packageghc-9.10.3
  • Exports20
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceLoader.hs
datadata LoaderState
#

Constructors

valueinitLoaderState :: Interp -> HscEnv -> IO ()
#

Initialise the dynamic linker. This entails

a) Calling the C initialisation procedure,

b) Loading any packages specified on the command line,

c) Loading any packages specified on the command line, now held in the -l options in v_Opt_l,

d) Loading any .o/.dll files specified on the command line, now held in ldInputs,

e) Loading any MacOS frameworks.

NOTE: This function is idempotent; if called more than once, it does nothing. This is useful in Template Haskell, where we call it before trying to link.

Load & Unload

7 declarations
valueloadPackages :: Interp -> HscEnv -> [UnitId] -> IO ()
#

Load exactly the specified packages, and their dependents (unless of course they are already loaded). The dependents are loaded automatically, and it doesn't matter what order you specify the input packages.

valueunload
  1. :: Interp
  2. -> HscEnv
  3. -> [Linkable]

    The linkables to *keep*.

  4. -> IO ()
#

Unloading old objects ready for a new compilation sweep.

The compilation manager provides us with a list of linkables that it considers "stable", i.e. won't be recompiled this time around. For each of the modules current linked in memory,

  • if the linkable is stable (and it's the same one -- the user may have recompiled the module on the side), we keep it,

  • otherwise, we unload it.

  • we also implicitly unload all temporary bindings at this point.

LoadedEnv

3 declarations

Internals

4 declarations