Context Hooks

The Binding Generator C->Haskell : Implementation of Haskell Binding Modules : Context Hooks
Previous: Import Hooks
Next: Type Hooks

## 2.2. Context Hooks

> `{#context [lib = lib] [prefix = prefix]#}`

Context hooks define a set of global configuration options. Currently, there are two parameters which are both strings

- lib is a dynamic library that contains symbols needed by the present binding.
- prefix is an identifier prefix that may be omitted in the lexemes of identifiers referring to C definitions in any binding hook. The is useful as C libraries often use a prefix, such as `gtk_`, as a form of poor man's name spaces. Any occurrence of underline characters between a prefix and the main part of an identifier must also be dropped. Case is not relevant in a prefix. In case of a conflict of the abbreviation with an explicitly defined identifier, the explicit definition takes preference.

Both parameters are optional. An example of a context hook is the following:

> `{#context prefix = "gtk"#}`

If a binding module contains a binding hook, it must be the first hook in the module.

The Binding Generator C->Haskell : Implementation of Haskell Binding Modules : Context Hooks
Previous: Import Hooks
Next: Type Hooks