\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 ()
-- 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
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
initLinker :: IO ()
foreign import "addDLL" unsafe
- c_addDLL :: PackedString -> IO (Ptr CChar)
+ c_addDLL :: PackedString -> PackedString -> IO (Ptr CChar)
\end{code}