@@ -217,8 +217,21 @@ global variable with the following name. The type must be just ``IO Ptr``.
217 errno : IO Ptr
217 errno : IO Ptr
218 errno = foreign FFI_C "&errno" (IO Ptr)
218 errno = foreign FFI_C "&errno" (IO Ptr)
220+If the foreign name is prefixed by a ``#``, the name is pasted in literally. This is
221+useful to access constants that are preprocessor definitions (like ``INT_MAX``).
224+ %include C "limits.h"
226+ -- access the preprocessor definition INT_MAX
228+ intMax = foreign FFI_C "#INT_MAX" (IO Int)
231+ main = print !intMax
220−For more complicated interactions with C (such as reading and setting fields of a C struct), there is
233+For more complicated interactions with C (such as reading and setting fields
221−a module CFFI available in the contrib package.
234+of a C struct), there is a module CFFI available in the contrib package.
223FFI implementation
236FFI implementation
224------------------
237------------------