[project @ 2002-07-29 09:54:40 by ross]
authorross <unknown>
Mon, 29 Jul 2002 09:54:41 +0000 (09:54 +0000)
committerross <unknown>
Mon, 29 Jul 2002 09:54:41 +0000 (09:54 +0000)
Tweaked imports and includes for compatibility.

Foreign/Marshal/Alloc.hs
Foreign/Marshal/Array.hs
Foreign/Marshal/Utils.hs

index 1687c82..25e5b78 100644 (file)
@@ -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 ()
index 16a3e47..ae7db1a 100644 (file)
@@ -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
index 08bee23..f4a3f73 100644 (file)
@@ -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 ()