# CFFI.Types

Types for interfacing with C.
This file should be kept free from IO.

translate : CType -> Type

  What Idris type the C type is marshalled to

sizeOf : Composite -> Int

  Size of value of the type in bytes

offsets : Composite -> List Int

  All offsets of a composite type

offset : Composite -> Nat -> Int

  The offset of a field in a composite type

mkComposite : CType -> Composite

  Implicit conversion of primitive C types to composites

fields : Composite -> Nat

  Number of fields in a composite type

fieldType : Composite -> Nat -> Composite

  The type of a field in a composite type.

alignOf : Composite -> Int

  Alignment requirement of the type

data Composite : Type

  Composites of C types

  T : CType -> Composite
  ARRAY : Int -> Composite -> Composite
  STRUCT : List Composite -> Composite
  UNION : List Composite -> Composite
  PACKEDSTRUCT : List Composite -> Composite
data CType : Type

  An universe of C types.

  I8 : CType
  I16 : CType
  I32 : CType
  I64 : CType
  FLOAT : CType
  DOUBLE : CType
  PTR : CType