[darcs-users] [darcs-devel] [issue898] very difficult to build win32 darcs with ghc-6.8.2
Salvatore Insalaco
kirby81 at gmail.com
Thu Jun 19 14:27:29 UTC 2008
2008/6/5 Tim Newsham <bugs at darcs.net>:
>
> Here's a small test program which uses FFI to SleepEx which I was
> not able to get working with win32 ghc-6.8.2.
>
> ------
> {-# OPTIONS -fglasgow-exts -fffi #-}
> module Main where
> import Foreign.C.Types
>
> foreign import ccall "SleepEx" c_SleepEx :: CUInt -> CInt -> IO CInt
>
> main = do
> putStrLn "start"
> n <- c_SleepEx (2*1000) 1
> print n
> -------
You have to use stdcall when you link to Windows DLLs.
If you substitute:
foreign import ccall "SleepEx" c_SleepEx :: CUInt -> CInt -> IO CInt
with
foreign import stdcall "SleepEx" c_SleepEx :: CUInt -> CInt -> IO CInt
it will work with a common "ghc --make".
Salvatore
More information about the darcs-users
mailing list