Foreign.LibFFI.Types

libffi-0.1: A binding to libffi

Safe Haskell | None
Language | Haskell98

Foreign.LibFFI.Types

Contents

- Arguments
  - Integral types
  - Floating point types
  - Various other C types
  - Strings
- Return types
  - Integral types
  - Floating point types
  - Various other C types
  - Strings

Description

Arguments and return types

Synopsis

- argCInt :: CInt -> Arg
- argCUInt :: CUInt -> Arg
- argCLong :: CLong -> Arg
- argCULong :: CULong -> Arg
- argInt :: Int -> Arg
- argInt8 :: Int8 -> Arg
- argInt16 :: Int16 -> Arg
- argInt32 :: Int32 -> Arg
- argInt64 :: Int64 -> Arg
- argWord :: Word -> Arg
- argWord8 :: Word8 -> Arg
- argWord16 :: Word16 -> Arg
- argWord32 :: Word32 -> Arg
- argWord64 :: Word64 -> Arg
- argCFloat :: CFloat -> Arg
- argCDouble :: CDouble -> Arg
- argCSize :: CSize -> Arg
- argCTime :: CTime -> Arg
- argCChar :: CChar -> Arg
- argCUChar :: CUChar -> Arg
- argCWchar :: CWchar -> Arg
- argPtr :: Ptr a -> Arg
- argFunPtr :: FunPtr a -> Arg
- argString :: String -> Arg
- argByteString :: ByteString -> Arg
- argConstByteString :: ByteString -> Arg
- retVoid :: RetType ()
- retCInt :: RetType CInt
- retCUInt :: RetType CUInt
- retCLong :: RetType CLong
- retCULong :: RetType CULong
- retInt :: RetType Int
- retInt8 :: RetType Int8
- retInt16 :: RetType Int16
- retInt32 :: RetType Int32
- retInt64 :: RetType Int64
- retWord :: RetType Word
- retWord8 :: RetType Word8
- retWord16 :: RetType Word16
- retWord32 :: RetType Word32
- retWord64 :: RetType Word64
- retCFloat :: RetType CFloat
- retCDouble :: RetType CDouble
- retCSize :: RetType CSize
- retCTime :: RetType CTime
- retCChar :: RetType CChar
- retCUChar :: RetType CUChar
- retCWchar :: RetType CWchar
- retPtr :: RetType a -> RetType (Ptr a)
- retFunPtr :: RetType a -> RetType (FunPtr a)
- retCString :: RetType CString
- retString :: RetType String
- retByteString :: RetType ByteString
- retMallocByteString :: RetType ByteString

# Arguments

## Integral types

argCInt :: CInt -> Arg #

argCUInt :: CUInt -> Arg #

argCLong :: CLong -> Arg #

argCULong :: CULong -> Arg #

argInt :: Int -> Arg #

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

argInt8 :: Int8 -> Arg #

argInt16 :: Int16 -> Arg #

argInt32 :: Int32 -> Arg #

argInt64 :: Int64 -> Arg #

argWord :: Word -> Arg #

argWord8 :: Word8 -> Arg #

argWord16 :: Word16 -> Arg #

argWord32 :: Word32 -> Arg #

argWord64 :: Word64 -> Arg #

## Floating point types

argCFloat :: CFloat -> Arg #

argCDouble :: CDouble -> Arg #

## Various other C types

argCSize :: CSize -> Arg #

argCTime :: CTime -> Arg #

argCChar :: CChar -> Arg #

argCUChar :: CUChar -> Arg #

argCWchar :: CWchar -> Arg #

argPtr :: Ptr a -> Arg #

argFunPtr :: FunPtr a -> Arg #

## Strings

argString :: String -> Arg #

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

argByteString :: ByteString -> Arg #

Like argString, but for ByteString's.

argConstByteString :: ByteString -> Arg #

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

# Return types

## Integral types

retVoid :: RetType () #

retCInt :: RetType CInt #

retCUInt :: RetType CUInt #

retCLong :: RetType CLong #

retCULong :: RetType CULong #

retInt :: RetType Int #

retInt8 :: RetType Int8 #

retInt16 :: RetType Int16 #

retInt32 :: RetType Int32 #

retInt64 :: RetType Int64 #

retWord :: RetType Word #

retWord8 :: RetType Word8 #

retWord16 :: RetType Word16 #

retWord32 :: RetType Word32 #

retWord64 :: RetType Word64 #

## Floating point types

retCFloat :: RetType CFloat #

retCDouble :: RetType CDouble #

## Various other C types

retCSize :: RetType CSize #

retCTime :: RetType CTime #

retCChar :: RetType CChar #

retCUChar :: RetType CUChar #

retCWchar :: RetType CWchar #

retPtr :: RetType a -> RetType (Ptr a) #

retFunPtr :: RetType a -> RetType (FunPtr a) #

## Strings

retCString :: RetType CString #

retString :: RetType String #

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

retByteString :: RetType ByteString #

Like retString, but for ByteString's

retMallocByteString :: RetType ByteString #

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