From: ross Date: Mon, 29 Jul 2002 09:54:41 +0000 (+0000) Subject: [project @ 2002-07-29 09:54:40 by ross] X-Git-Tag: nhc98-1-18-release~925 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0ff039ce128bde2eecd179d0c766d1209c16ca44;p=ghc-base.git [project @ 2002-07-29 09:54:40 by ross] Tweaked imports and includes for compatibility. --- diff --git a/Foreign/Marshal/Alloc.hs b/Foreign/Marshal/Alloc.hs index 1687c82..25e5b78 100644 --- a/Foreign/Marshal/Alloc.hs +++ b/Foreign/Marshal/Alloc.hs @@ -39,6 +39,8 @@ import GHC.Real import GHC.Ptr import GHC.Err import GHC.Base +#else +import Control.Exception ( bracket ) #endif @@ -140,6 +142,6 @@ failWhenNULL name f = do -- basic C routines needed for memory allocation -- -foreign import ccall unsafe "malloc" _malloc :: CSize -> IO (Ptr a) -foreign import ccall unsafe "realloc" _realloc :: Ptr a -> CSize -> IO (Ptr b) -foreign import ccall unsafe "free" _free :: Ptr a -> IO () +foreign import ccall unsafe "stdlib.h malloc" _malloc :: CSize -> IO (Ptr a) +foreign import ccall unsafe "stdlib.h realloc" _realloc :: Ptr a -> CSize -> IO (Ptr b) +foreign import ccall unsafe "stdlib.h free" _free :: Ptr a -> IO () diff --git a/Foreign/Marshal/Array.hs b/Foreign/Marshal/Array.hs index 16a3e47..ae7db1a 100644 --- a/Foreign/Marshal/Array.hs +++ b/Foreign/Marshal/Array.hs @@ -60,12 +60,12 @@ module Foreign.Marshal.Array ( ) where import Control.Monad - -#ifdef __GLASGOW_HASKELL__ -import Foreign.Ptr (Ptr, plusPtr) -import GHC.Storable (Storable(sizeOf,peekElemOff,pokeElemOff)) +import Foreign.Ptr (Ptr, plusPtr) +import Foreign.Storable (Storable(sizeOf,peekElemOff,pokeElemOff)) import Foreign.Marshal.Alloc (alloca, mallocBytes, allocaBytes, reallocBytes) import Foreign.Marshal.Utils (copyBytes, moveBytes) + +#ifdef __GLASGOW_HASKELL__ import GHC.IOBase import GHC.Num import GHC.List diff --git a/Foreign/Marshal/Utils.hs b/Foreign/Marshal/Utils.hs index 08bee23..f4a3f73 100644 --- a/Foreign/Marshal/Utils.hs +++ b/Foreign/Marshal/Utils.hs @@ -51,12 +51,12 @@ module Foreign.Marshal.Utils ( ) where import Data.Maybe - -#ifdef __GLASGOW_HASKELL__ import Foreign.Ptr ( Ptr, nullPtr ) -import GHC.Storable ( Storable(poke) ) +import Foreign.Storable ( Storable(poke) ) import Foreign.C.TypesISO ( CSize ) import Foreign.Marshal.Alloc ( malloc, alloca ) + +#ifdef __GLASGOW_HASKELL__ import GHC.IOBase import GHC.Real ( fromIntegral ) import GHC.Num @@ -170,5 +170,5 @@ moveBytes dest src size = memmove dest src (fromIntegral size) -- |Basic C routines needed for memory copying -- -foreign import ccall unsafe memcpy :: Ptr a -> Ptr a -> CSize -> IO () -foreign import ccall unsafe memmove :: Ptr a -> Ptr a -> CSize -> IO () +foreign import ccall unsafe "string.h" memcpy :: Ptr a -> Ptr a -> CSize -> IO () +foreign import ccall unsafe "string.h" memmove :: Ptr a -> Ptr a -> CSize -> IO ()