[project @ 2001-07-11 19:48:07 by sof]
[ghc-hetmet.git] / ghc / compiler / ghci / Linker.lhs
index 8b0d15a..5d16633 100644 (file)
@@ -5,6 +5,10 @@
 
 \begin{code}
 {-# OPTIONS -#include "Linker.h" #-}
+
+-- so that we can see defn of LEADING_UNDERSCORE
+#include "../includes/config.h"
+
 module Linker ( 
    initLinker,  -- :: IO ()
    loadObj,      -- :: String -> IO ()
@@ -24,7 +28,12 @@ import Panic         ( panic )
 -- RTS Linker Interface
 -- ---------------------------------------------------------------------------
 
-lookupSymbol str = do
+lookupSymbol str_in = do
+#  ifdef LEADING_UNDERSCORE
+   let str = '_':str_in
+#  else
+   let str = str_in
+#  endif
    addr <- c_lookupSymbol (packString str)
    if addr == nullPtr
        then return Nothing
@@ -48,8 +57,8 @@ resolveObjs = do
        then panic "resolveObjs: failed"
        else return ()
 
-addDLL str = do
-   maybe_errmsg <- c_addDLL (packString str)
+addDLL path lib = do
+   maybe_errmsg <- c_addDLL (packString path) (packString lib)
    return maybe_errmsg
 
 type PackedString = ByteArray Int
@@ -70,6 +79,6 @@ foreign import "initLinker" unsafe
    initLinker :: IO ()
 
 foreign import "addDLL" unsafe 
-   c_addDLL :: PackedString -> IO (Ptr CChar)
+   c_addDLL :: PackedString -> PackedString -> IO (Ptr CChar)
 
 \end{code}