2008/6/5 Tim Newsham <[EMAIL PROTECTED]>:
>
> 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
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to