> For the complete documentation index, see [llms.txt](https://libec.erayd.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://libec.erayd.net/misc.md).

# Misc

Various functions which don't fit into any other category.

## API

* [ec\_init()](/misc.md#ec-init)
* [ec\_version()](/misc.md#ec-version)
* [ec\_errstr()](/misc.md#ec-errstr)

### ec\_init()

`ec_err_t ec_init(void);`

Initialises libec and its dependencies. Returns a nonzero error code on failure. `ec_init()` must be called before any other function in the library.

This function may be called more than once, but is not thread-safe.

```c
#include <ec/h>
...
if(ec_init() == 0) {
    //initialised OK
}
...
```

### ec\_version()

`char *ec_version(void);`

Returns the version of libec in use. This function is guaranteed to return a valid string.

```c
#include <ec.h>
...
printf("Libec version: %s\n", ec_version());
...
```

### ec\_errstr()

`char *ec_errstr(ec_err_t error);`

Get a string description for a libec error code.

```c
#include <ec.h>
...
printf("Error: %s\n", ec_errstr(error));
...
```
