How to find out the C type signature corresponding to a Haskell function type in FFI?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Mar 8 18:20:00 EST 2006


"Brian Hulley" <brianh at metamilk.com> writes:

> I've got a Haskell module with the following ffi import:
>
> foreign import ccall duma_init :: Int -> IO Int
>
> However my problem is that I've got no idea what the type signature
> for the corresponding C function should be,

HsInt duma_init(HsInt arg);

Or use int on the C side and CInt on the Haskell side.

fromIntegral can be used for converting integers in Haskell.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Glasgow-haskell-users mailing list