Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/5e4bab8c684ea961f08dc9c4f1799991645c32b1

>---------------------------------------------------------------

commit 5e4bab8c684ea961f08dc9c4f1799991645c32b1
Author: Ian Lynagh <[email protected]>
Date:   Wed May 16 15:14:36 2012 +0100

    Don't use stdcall on Win64: It isn't supported; ccall is used instead

>---------------------------------------------------------------

 compiler/main/SysTools.lhs |   12 +++++++++++-
 utils/ghc-pkg/Main.hs      |   12 +++++++++++-
 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 5d643f1..848e02d 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 e63139e..83b5447 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 8eb46b5..6dae543 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



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to