package codex

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module HookSource

A hook is a place where functions are registered. These functions are called when some events happen. This is useful to execute imperative actions such as loading/storing data to files, opening or cleaning resources, etc.

Sourcetype 'a hook

A hook containing functions called with a 'a argument (often unit).

Sourceval add_hook : 'a hook -> name:string -> ('a -> unit) -> unit

Add a function to be called when the hook is run. The name is used for debugging purposes.

Sourceval run_hook : 'a hook -> 'a -> unit

Execute all functions in the hook, with a given argument.

Sourceval startup : unit hook

This hook runs once, after the command line has been parsed, essential utilities (e.g. logging) is setup, and the library has been initialized.

Sourceval after_domain_build : unit hook

This hook runs once, after the domain for the analysis has been built

Sourceval exit : unit hook

This hook runs once when the program linked with Codex exits. It allows cleaning up resources, saving files etc. This hook is already registered to run.