Linking with C library

Full working code for concepts described in this section is here.

Begin by adding fdb crate as a dependency in your Cargo.toml file.

[dependencies]
fdb = "0.x"

fdb crate supports linking with different versions of the C library using cargo feature flags. In order to correctly build your application, you are required to specify the version of the C library to link against. This can be done in two ways. Either by using the command line option --features fdb/fdb-X_Y or by specifying the following in your Cargo.toml. Here X is the major version and Y is the minor version of FoundationDB.

[features]
default = ["fdb/fdb-X_Y"]

If you have installed libfdb_c.so in a non-standard location, you can use the environment variable RUSTC_LINK_SEARCH_FDB_CLIENT_LIB to specify the location of the C library.

Note While it is required for your application to link to a specific version of fdb_c library during build time, FoundationDB client can also dynamically load newer version during runtime. This feature is used during cluster upgrades. See this link for details.

Edit this page on GitHub