GHCi.ObjLink

ghci-8.8.0.20190721: The library supporting GHC's interactive interpreter

Safe Haskell | None
Language | Haskell2010

GHCi.ObjLink

Description

Primarily, this module consists of an interface to the C-land dynamic linker.

Synopsis

- initObjLinker :: ShouldRetainCAFs -> IO ()
- data ShouldRetainCAFs
  - = RetainCAFs
  - | DontRetainCAFs
- loadDLL :: String -> IO (Maybe String)
- loadArchive :: String -> IO ()
- loadObj :: String -> IO ()
- unloadObj :: String -> IO ()
- purgeObj :: String -> IO ()
- lookupSymbol :: String -> IO (Maybe (Ptr a))
- lookupClosure :: String -> IO (Maybe HValueRef)
- resolveObjs :: IO Bool
- addLibrarySearchPath :: String -> IO (Ptr ())
- removeLibrarySearchPath :: Ptr () -> IO Bool
- findSystemLibrary :: String -> IO (Maybe String)

# Documentation

initObjLinker :: ShouldRetainCAFs -> IO () Source #

data ShouldRetainCAFs Source #

Constructors

RetainCAFs | Retain CAFs unconditionally in linked Haskell code. Note that this prevents any code from being unloaded. It should not be necessary unless you are GHCi or hs-plugins, which needs to be able call any function in the compiled code.
DontRetainCAFs | Do not retain CAFs. Everything reachable from foreign exports will be retained, due to the StablePtrs created by the module initialisation code. unloadObj frees these StablePtrs, which will allow the CAFs to be GC'd and the code to be removed.

loadDLL :: String -> IO (Maybe String) Source #

loadDLL loads a dynamic library using the OS's native linker (i.e. dlopen() on Unix, LoadLibrary() on Windows). It takes either an absolute pathname to the file, or a relative filename (e.g. "libfoo.so" or "foo.dll"). In the latter case, loadDLL searches the standard locations for the appropriate library.

loadArchive :: String -> IO () Source #

loadObj :: String -> IO () Source #

unloadObj :: String -> IO () Source #

`unloadObj` drops the given dynamic library from the symbol table as well as enables the library to be removed from memory during a future major GC.

purgeObj :: String -> IO () Source #

`purgeObj` drops the symbols for the dynamic library from the symbol table. Unlike `unloadObj`, the library will not be dropped memory during a future major GC.

lookupSymbol :: String -> IO (Maybe (Ptr a)) Source #

lookupClosure :: String -> IO (Maybe HValueRef) Source #

resolveObjs :: IO Bool Source #

addLibrarySearchPath :: String -> IO (Ptr ()) Source #

removeLibrarySearchPath :: Ptr () -> IO Bool Source #

findSystemLibrary :: String -> IO (Maybe String) Source #