[Haskell-cafe] advanced cabal configuration

Manuel Gómez targen at gmail.com
Tue May 19 14:06:32 UTC 2015


On Tue, May 19, 2015 at 9:29 AM, Jonas Scholl
<anselm.scholl at tu-harburg.de> wrote:
> 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"

This has the advantage of being nicer to cross-compilers.  Perhaps it
won’t degrade performance significantly.


More information about the Haskell-Cafe mailing list