{-# OPTIONS -#include "Linker.h" #-}
module ObjLink (
- initLinker, -- :: IO ()
- loadDLL, -- :: String -> IO (Maybe String)
- loadObj, -- :: String -> IO ()
- unloadObj, -- :: String -> IO ()
- lookupSymbol, -- :: String -> IO (Maybe (Ptr a))
- resolveObjs -- :: IO SuccessFlag
+ initObjLinker, -- :: IO ()
+ loadDLL, -- :: String -> IO (Maybe String)
+ loadObj, -- :: String -> IO ()
+ unloadObj, -- :: String -> IO ()
+ lookupSymbol, -- :: String -> IO (Maybe (Ptr a))
+ resolveObjs -- :: IO SuccessFlag
) where
import Monad ( when )
import Foreign.C
import Foreign ( Ptr, nullPtr )
import Panic ( panic )
-import DriverUtil ( prefixUnderscore )
import BasicTypes ( SuccessFlag, successIf )
+import Config ( cLeadingUnderscore )
import Outputable
-- ---------------------------------------------------------------------------
then return Nothing
else return (Just addr)
+prefixUnderscore :: String -> String
+prefixUnderscore
+ | cLeadingUnderscore == "YES" = ('_':)
+ | otherwise = id
+
loadDLL :: String -> IO (Maybe String)
-- Nothing => success
-- Just err_msg => failure
#if __GLASGOW_HASKELL__ >= 504
foreign import ccall unsafe "addDLL" c_addDLL :: CString -> IO CString
-foreign import ccall unsafe "initLinker" initLinker :: IO ()
+foreign import ccall unsafe "initLinker" initObjLinker :: IO ()
foreign import ccall unsafe "lookupSymbol" c_lookupSymbol :: CString -> IO (Ptr a)
foreign import ccall unsafe "loadObj" c_loadObj :: CString -> IO Int
foreign import ccall unsafe "unloadObj" c_unloadObj :: CString -> IO Int