
20 May
2015
20 May
'15
2:02 a.m.
Hi Jonas,
Couldn't you write something like this?
foreign import ccall unsafe "sendfile64" c_sendfile64 :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
foreign import ccall unsafe "sendfile" c_sendfile32 :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
c_sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t) c_sendfile = case sizeOf (undefined :: COff) of 4 -> c_sendfile32 8 -> c_sendfile64 _ -> error "COff has an unsupported size"
I think that this is possible. Thank you for your suggestion! --Kazu