# GB.Hook

`void * GB.Hook ( int type , void * hook )`

Installs a global interpreter hook.

- type is an integer constant that identifies the hook.
- hook is the hook function pointer. See The interpreter hooks to get more details about the hook function prototypes.

There are six global hooks :

- `GB_HOOK_MAIN` to parse the command line.
- `GB_HOOK_LOOP` to manage the event loop.
- `GB_HOOK_WAIT` to implement the WAIT instruction.
- `GB_HOOK_BEEP` to implement the not yet existing BEEP instruction :-).
- `GB_HOOK_WATCH` to watch a file descriptor.
- `GB_HOOK_POST` to execute callback functions at the next call of the event loop.

This function returns the previous hook, so that you can call it yourself if necessary. I think this is useful only to the `GB_HOOK_MAIN` hook.