This package contains the C-ABI of symbolic. It builds a C header file and associated library that
can be linked to any C or C++ program. Note that the header is C only. Primarily, this package is
meant to be consumed by higher-level wrappers in other languages, such as the
symbolic
Python package.
Building the dynamic library has the same requirements as building the symbolic
crate:
- Latest stable Rust and Cargo
- A C++14 compiler
- A checkout of this repository and all its GIT submodules.
To build, run make release
in this directory. This creates a release build of the dynamic library
in target/release/libsymbolic.*
.
The header comes packaged in the include/
directory. It does not have any dependencies other than
standard C headers.
In your application, point to the symbolic include directory and specify the symbolic library:
$(CC) -Isymbolic/symbolic-cabi/include -Lsymbolic/target/release -lsymbolic_cabi -o myprogram main.c
In addition to the build requirements, development requires a recent Rust nightly toolchain and
the cbindgen
tool. To set this up, run:
rustup toolchain add nightly
cargo install cbindgen
If your machine already has cbindgen
installed, check the header of [include/symbolic.h
] for the
minimum version required. This can be verified by running cbindgen --version
. It is generally
advisable to keep cbindgen
updated to its latest version, and always check in cbindgen updates
separate from changes to the public interface.
This package contains the Rust crate symbolic_cabi
that exposes a public FFI interface. There are
additional build steps involved in generating the header file located at include/symbolic.h
. To
aid development, there is a Makefile that exposes all relevant commands for building:
make build
: Builds the library usingcargo
.make header
: Updates the header file based on the public interface ofsymbolic_cabi
.make test
: Runs a small integration test that verifies that the library builds and links.make clean
: Removes all build artifacts but leaves the header.make
: Builds the library, the header, and runs tests.
For ease of development, the header is always checked into the repository. After making changes, do
not forget to run at least make header
to ensure the header is in sync with the library.
- Make changes to the
symbolic
crates and add tests. - Update
symbolic_cabi
and add, remove or update functions as needed. - Regenerate the header and run tests by running
make test
in thecabi/
directory. - Go to the Python package in the
py/
folder and update the high-level wrappers. - Consider whether this changeset requires a major version bump.
The general rule for major versions is:
- If everything is backward compatible, do not major bump.
- If the C interface breaks compatibility but high-level wrappers are still backwards compatible, do not major bump. The C interface is currently viewed as an implementation detail.
- If high-level wrappers are no longer backwards compatible or there are breaking changes in the
symbolic
crate itself, do major bump.