libffi-0.1: A binding to libffi

Foreign.LibFFI.Types

Contents

Description

Arguments and return types

Synopsis

Arguments

Integral types

argInt :: Int -> ArgSource

Note that on e.g. x86_64, Int /= CInt

Floating point types

Various other C types

Strings

argString :: String -> ArgSource

The string argument is passed to C as a char * pointer, which is freed afterwards. The argument should not contain zero-bytes.

argByteString :: ByteString -> ArgSource

Like argString, but for ByteString's.

argConstByteString :: ByteString -> ArgSource

Like argByteString, but changing the string from C breaks referential transparency.

Return types

Integral types

Floating point types

Various other C types

Strings

retString :: RetType StringSource

Peek a String out of the returned char *. The char * is not freed.

retByteString :: RetType ByteStringSource

Like retString, but for ByteString's

retMallocByteString :: RetType ByteStringSource

Make a ByteString out of the returned char *. The char * will be free(3)ed when the ByteString is garbage collected.