Libecoli 0.11.1
Extensible COmmand LIne library
Loading...
Searching...
No Matches
Initialization

Library initialization and cleanup functions. More...

Data Structures

struct  ec_init

Macros

#define EC_INIT_REGISTER(t)

Typedefs

typedef int ec_init_t(void)
typedef void ec_exit_t(void)

Functions

void ec_init_register (struct ec_init *test)
int ec_init (void)
void ec_exit (void)

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
testA 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.

◆ ec_exit()

void ec_exit ( void )

Uninitialize ecoli library.