eccodes_sys/lib.rs
1#![allow(unused)]
2#![allow(non_upper_case_globals)]
3#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5
6//!# Low-level Rust bindings for ecCodes
7//!
8//!Bindings for this documentation have been generated on Ubuntu 24.04 with `libeccodes` 2.34.1
9//!
10//!**This is a `-sys` crate with raw, unsafe bindings to the library and its API should not be used directly.**
11//!See the [eccodes crate](https://github.com/ScaleWeather/eccodes) for high-level, safe bindings.
12//!
13//!**Due to the complexity of ecCodes library the decision has been made that this crate will not build ecCodes from source.**
14//!See sections below for additional information how to install ecCodes on your system.
15//!
16// is an open-source library for
17//!reading and writing GRIB and BUFR files developed by [European Centre for Medium-Range Weather Forecasts](https://www.ecmwf.int/).
18//!
19//!## Usage
20//!
21//!This crate will look for existing `libeccodes` installation using [pkg-config](https://crates.io/crates/pkg-config).
22//!The ecCodes library is then linked and bindings are generated using [bindgen](https://crates.io/crates/bindgen).
23//!If the library is not found, the build will fail.
24//!
25//!## ecCodes installation
26//!
27//!The reccomended way to install ecCodes on your computer is using your package manager.
28//!For example, on Ubuntu you can use `apt-get`:
29//!
30//!```text
31//!$ sudo apt-get install libeccodes-dev
32//!```
33//!
34//!Alternatively, you can install the library manually from source in suitable directory
35//!following [this instructions](https://confluence.ecmwf.int/display/ECC/ecCodes+installation).
36//!
37//!Then add the `lib/pkgconfig` directory from your ecCodes installation directory
38//!to the `PKG_CONFIG_PATH` environmental variable. If ecCodes have been compiled
39//!as shared library you will also need to specify `LD_LIBRARY_PATH`.
40//!For example:
41//!
42//!```text
43//!export PKG_CONFIG_PATH=<your_eccodes_path>/lib/pkgconfig
44//!export LD_LIBRARY_PATH=<your_eccodes_path>/lib
45//!```
46//!
47//!
48//!## Features
49//!
50//!There are two development features available:
51//!
52//!- `docs` - for documentation building, does not link ecCodes and includes `bindings-docs.rs` into `lib.rs`
53//!- `tests` - turns on generation of layout tests by `bindgen`, should not be used in production. Layout tests are off by default as they derefrence null pointers causing undefined behaviour
54//!
55
56use std::sync::Mutex;
57
58/// Global mutex to synchronize functions that fail in concurrent context,
59/// eg. `codes_handle_new_from_file`, `codes_index_add_file` etc.
60pub static CODES_LOCK: Mutex<()> = Mutex::new(());
61
62#[cfg(not(feature = "docs"))]
63include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
64
65#[cfg(feature = "docs")]
66include!("bindings-docs.rs");