From 50532af6499e44c7fab6f1b99bb7fa937d568007 Mon Sep 17 00:00:00 2001 From: reid Date: Sat, 3 Aug 2002 21:33:15 +0000 Subject: [PATCH] [project @ 2002-08-03 21:33:15 by reid] Directives like this {-# OPTIONS -#include "HsBase.h" #-} aren't portable so I added this: foreign import ccall unsafe "HsBase.h ghcErrno" _errno :: Ptr CInt ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ --- Foreign/C/Error.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Foreign/C/Error.hs b/Foreign/C/Error.hs index 7dc8d3a..a574086 100644 --- a/Foreign/C/Error.hs +++ b/Foreign/C/Error.hs @@ -97,6 +97,8 @@ import GHC.IOBase (Exception(..), IOException(..), IOErrorType(..)) -- regular imports -- --------------- +import System.IO.Unsafe( unsafePerformIO ) +import Foreign.Storable import Foreign.Ptr import Foreign.C.Types import Foreign.C.String @@ -119,7 +121,7 @@ import System.IO ( IOError, Handle, ioError ) -- This function exists because errno is a variable on some systems, but on -- Windows it is a macro for a function... -- [yes, global variables and thread safety don't really go hand-in-hand. -- sof] -foreign import ccall unsafe "ghcErrno" _errno :: Ptr CInt +foreign import ccall unsafe "HsBase.h ghcErrno" _errno :: Ptr CInt -- Haskell representation for "errno" values -- @@ -511,7 +513,7 @@ errnoToIOError loc errno maybeHdl maybeName = unsafePerformIO $ do return (userError (loc ++ ": " ++ str ++ maybe "" (": "++) maybeName)) #endif -foreign import ccall unsafe strerror :: Errno -> IO (Ptr CChar) +foreign import ccall unsafe "string.h" strerror :: Errno -> IO (Ptr CChar) -- Dreadfully tedious callouts to wrappers which define the -- 1.7.10.4