Loading...
Searching...
No Matches
Initialization

Library initialization and cleanup functions. More...

## Data Structures

struct | ec_init
| A structure describing initialization callbacks. More...

## Macros

#define | EC_INIT_REGISTER(t)
| Register initialization and exit callbacks.

## Typedefs

typedef int | ec_init_t(void)
| Type of init function.
typedef void | ec_exit_t(void)
| Type of exit function.

## Functions

void | ec_init_register (struct ec_init *test)
| Register an initialization function.
int | ec_init (void)
| Initialize ecoli library.
void | ec_exit (void)
| Uninitialize ecoli library.

## Detailed Description

Library initialization and cleanup functions.

## Macro Definition Documentation

## EC_INIT_REGISTER

#define EC_INIT_REGISTER | ( |  | t | ) |

Value:
static void ec_init_init_##t(void); \
static void __attribute__((constructor, used)) ec_init_init_##t(void) \
{ \
ec_init_register(&t); \
}

Register initialization and exit callbacks.

These callbacks are ordered by priority: for initialization, the lowest priority is called first. For exit, the callbacks are invoked in reverse order.

Priority policy: 0 .. 99 : reserved for libecoli internal use. 100 .. : available for user code (recommended).

Do not use priorities < 100 for application code; internal libecoli components may depend on those priorities and using them can lead to uninitialized state, crashes, or undefined behavior.

Definition at line 29 of file init.h.

## Typedef Documentation

## ec_init_t

typedef int ec_init_t(void)

Type of init function.

Return 0 on success, -1 on error.

Definition at line 39 of file init.h.

## ec_exit_t

typedef void ec_exit_t(void)

Type of exit function.

Definition at line 44 of file init.h.

## Function Documentation

## ec_init_register()

void ec_init_register | ( | struct ec_init * | test | ) |

Register an initialization function.

Parameters

  test | A pointer to an ec_init structure to be registered.

## ec_init()

int ec_init | ( | void |  | ) |

Initialize ecoli library.

Must be called before any other function from libecoli.

Returns
  0 on success, -1 on error (errno is set).

Examples
  extension-editline/main.c, parse-yaml/parse-yaml.c, pool-editline/main.c, readline/main.c, and simple-editline/main.c.