Don't use stdcall on Win64: It isn't supported; ccall is used instead
authorIan Lynagh <igloo@earth.li>
Wed, 16 May 2012 14:15:37 +0000 (15:15 +0100)
committerIan Lynagh <igloo@earth.li>
Wed, 16 May 2012 14:15:37 +0000 (15:15 +0100)
Main.hs

diff --git a/Main.hs b/Main.hs
index 689997b..9838141 100644 (file)
--- a/Main.hs
+++ b/Main.hs
@@ -40,6 +40,16 @@ import DirectCodegen
 import Flags
 import HSCParser
 
+#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
+
 #ifdef BUILD_NHC
 getDataFileName s = do here <- getCurrentDirectory
                        return (here++"/"++s)
@@ -222,7 +232,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