This project provides C and C++ bindings for MLA.
The latest versions of the libraries are available in the Releases section.
Each release provides:
.hand.hppheaders — generated automatically for easy integration, no Rust toolchain required.libmla.afor Linux (x86-64)mla.lib(static),mla.dll+mla.dll.lib(dynamic), andmla.pdb(debug symbols) for Windows (i686 and x86_64), in both Release and Debug builds.
You can also compile the libraries manually using the Rust toolchain.
Install cbindgen if it's not already installed:
cargo install cbindgen
# Generate the C header
cbindgen --config cbindgen_c.toml
# Generate the C++ header
cbindgen --config cbindgen_cpp.toml# Add the Windows MSVC target as an example
rustup target add x86_64-pc-windows-msvc# Debug build for Windows MSVC target
cargo build --target x86_64-pc-windows-msvc
# Release build for Windows MSVC target
cargo build --release --target x86_64-pc-windows-msvcIf you are linking your own application against mla.lib (the static library), you must also link against ntdll.lib.
To build or link properly on Windows:
- Make sure the appropriate linker is available.
- Install the Microsoft Visual Studio Build Tools (with C++ components).
- Use a Developer Command Prompt for Visual Studio to ensure the environment is correctly configured.
- Linux: tests/linux-gcc-g++/create.c
- Windows: tests/windows-msvc/src/write.c
- Linux: tests/linux-gcc-g++/open.c
- Windows: tests/windows-msvc/src/read.c
The API is available in mla.h and mla.hpp.
create_mla_writer_config_with_encryption_with_signature(...)create_mla_writer_config_with_encryption_without_signature(...)create_mla_writer_config_without_encryption_with_signature(...)create_mla_writer_config_without_encryption_without_signature(...)
create_mla_reader_config(...)
Provide private keys for decryption and public keys for signature verification.
mla_writer_config_set_compression_level(hConfig, level)
Valid levels: 1 (fastest) to 11 (best), 6 is default.
mla_archive_new(...)mla_archive_start_entry_with_path_as_name(...)mla_archive_file_append(...)mla_archive_file_close(...)mla_archive_close(...)
mla_archive_open(...)mla_archive_list_entries(...)mla_archive_open_entry_by_name(...)mla_archive_file_read(...)mla_archive_file_close(...)mla_archive_close(...)
All functions return MLAStatus. Use MLA_STATUS(MLA_STATUS_SUCCESS) to check for success.
- Encryption and signing are explicit; choose your config accordingly.
- Output/input is managed via user-provided callbacks for writing, flushing, and reading.
- Handles are used for configs, archives, and files.
- Both writer and reader APIs are available.
See the tests directory for more usage examples.
Tests are run by CI and can be run locally using the provided Makefile and Visual Studio projects.
MLA bindings for C currently do not support the Send feature; handles and objects are not thread-safe.