diff options
author | Ian Lynagh <igloo@earth.li> | 2012-05-16 15:14:36 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-05-16 15:14:36 +0100 |
commit | 5e4bab8c684ea961f08dc9c4f1799991645c32b1 (patch) | |
tree | 42a7824cc6f28404bc5a6138741b0690d840d3d8 | |
parent | 5ccb43f3306bb0907948d97ea6bffe9f70c69554 (diff) | |
download | haskell-5e4bab8c684ea961f08dc9c4f1799991645c32b1.tar.gz |
Don't use stdcall on Win64: It isn't supported; ccall is used instead
-rw-r--r-- | compiler/main/SysTools.lhs | 12 | ||||
-rw-r--r-- | utils/ghc-pkg/Main.hs | 12 | ||||
-rw-r--r-- | utils/runghc/runghc.hs | 10 |
3 files changed, 31 insertions, 3 deletions
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index 5d643f1319..848e02d47d 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -79,6 +79,16 @@ import System.Process import Control.Concurrent import FastString import SrcLoc ( SrcLoc, mkSrcLoc, noSrcSpan, mkSrcSpan ) + +#ifdef mingw32_HOST_OS +# if defined(i386_HOST_ARCH) +# define WINDOWS_CCONV stdcall +# elif defined(x86_64_HOST_ARCH) +# define WINDOWS_CCONV ccall +# else +# error Unknown mingw32 arch +# endif +#endif \end{code} How GHC finds its files @@ -971,7 +981,7 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. where fail = panic ("can't decompose ghc.exe path: " ++ show s) lower = map toLower -foreign import stdcall unsafe "windows.h GetModuleFileNameW" +foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 #else getBaseDir = return Nothing diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index e63139e997..83b5447789 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -69,6 +69,16 @@ import qualified System.Info(os) import System.Console.Terminfo as Terminfo #endif +#ifdef mingw32_HOST_OS +# if defined(i386_HOST_ARCH) +# define WINDOWS_CCONV stdcall +# elif defined(x86_64_HOST_ARCH) +# define WINDOWS_CCONV ccall +# else +# error Unknown mingw32 arch +# endif +#endif + -- ----------------------------------------------------------------------------- -- Entry point @@ -1650,7 +1660,7 @@ getExecPath = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. _ | ret < size -> fmap Just $ peekCWString buf | otherwise -> try_size (size * 2) -foreign import stdcall unsafe "windows.h GetModuleFileNameW" +foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 #else getLibDir :: IO (Maybe String) diff --git a/utils/runghc/runghc.hs b/utils/runghc/runghc.hs index 8eb46b57f1..6dae543fe9 100644 --- a/utils/runghc/runghc.hs +++ b/utils/runghc/runghc.hs @@ -32,6 +32,14 @@ import Foreign import Foreign.C.String #endif +#if defined(i386_HOST_ARCH) +# define WINDOWS_CCONV stdcall +#elif defined(x86_64_HOST_ARCH) +# define WINDOWS_CCONV ccall +#else +# error Unknown mingw32 arch +#endif + main :: IO () main = do args <- getArgs @@ -157,7 +165,7 @@ getExecPath = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. _ | ret < size -> fmap Just $ peekCWString buf | otherwise -> try_size (size * 2) -foreign import stdcall unsafe "windows.h GetModuleFileNameW" +foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 #else getExecPath = return Nothing |