2 % (c) The University of Glasgow, 2000
4 \section[Linker]{The In-Memory Object File Linker}
7 {-# OPTIONS -#include "Linker.h" #-}
9 loadObj, -- :: String -> IO ()
10 unloadObj, -- :: String -> IO ()
11 lookupSymbol, -- :: String -> IO (Maybe Addr)
12 resolveObjs, -- :: IO ()
17 import PrelPack (packString)
18 import Panic ( panic )
20 -- ---------------------------------------------------------------------------
21 -- RTS Linker Interface
22 -- ---------------------------------------------------------------------------
25 addr <- c_lookupSymbol (packString str)
28 else return (Just addr)
31 r <- c_loadObj (packString str)
33 then panic "loadObj: failed"
37 r <- c_unloadObj (packString str)
39 then panic "unloadObj: failed"
45 then panic "resolveObjs: failed"
49 type PackedString = ByteArray Int
51 foreign import "lookupSymbol" unsafe
52 c_lookupSymbol :: PackedString -> IO Addr
54 foreign import "loadObj" unsafe
55 c_loadObj :: PackedString -> IO Int
57 foreign import "unloadObj" unsafe
58 c_unloadObj :: PackedString -> IO Int
60 foreign import "resolveObjs" unsafe
61 c_resolveObjs :: IO Int