Chapter 8. Foreign function interface (FFI)

Table of Contents
8.1. GHC extensions to the FFI Addendum
8.2. Using the FFI with GHC

GHC (mostly) conforms to the Haskell 98 Foreign Function Interface Addendum 1.0, whose definition is available from The FFI support in GHC diverges from the Addendum in the following ways:

The FFI libraries are documented in the accompanying library documentation; see for example the Foreign module.

8.1. GHC extensions to the FFI Addendum

The FFI features that are described in this section are specific to GHC. Avoid them where possible to not compromise the portability of the resulting code.

8.1.1. Unboxed types

The following unboxed types may be used as basic foreign types (see FFI Addendum, Section 3.2): Int#, Word#, Char#, Float#, Double#, Addr#, StablePtr# a, MutableByteArray#, ForeignObj#, and ByteArray#.