From a5946c015e372750fd8d2054bb8a7e975149c9cc Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 9 Dec 2016 09:48:41 -0500 Subject: haddock-api: Don't use stdcall calling convention on 64-bit Windows See GHC #12890. --- haddock-api/src/Haddock.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'haddock-api/src') 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 -- cgit v1.2.3