aboutsummaryrefslogtreecommitdiff
path: root/haddock-api
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-12-09 09:48:41 -0500
committerBen Gamari <ben@smart-cactus.org>2016-12-09 09:48:41 -0500
commita5946c015e372750fd8d2054bb8a7e975149c9cc (patch)
treecc3514fab7328f5ec7b0648061a137b4431b0d9a /haddock-api
parent1dcefaddc52d968b20bb6107d620e1e0c6839970 (diff)
haddock-api: Don't use stdcall calling convention on 64-bit Windows
See GHC #12890.
Diffstat (limited to 'haddock-api')
-rw-r--r--haddock-api/src/Haddock.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index 5e8f4a4a..6a784f48 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -576,7 +576,15 @@ getExecDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32.
_ | ret < size -> fmap (Just . dropFileName) $ peekCWString buf
| otherwise -> try_size (size * 2)
-foreign import stdcall unsafe "windows.h GetModuleFileNameW"
+# 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
+
+foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"
c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32
#else
getExecDir = return Nothing