Build and use LMDB in zig.
Supported use cases:
Clone this repository, then run zig build
.
You will find a statically linked lmdb
archive in zig-out/lib/liblmdb.a
.
You can use this with any language or build system.
Fetch lmdb
and save it to your build.zig.zon
:
zig fetch --save=lmdb https://github.com/Syndica/lmdb-zig/archive/<COMMIT_HASH>.tar.gz
Add the import to a module:
const lmdb = b.dependency("lmdb", .{}).module("lmdb");
exe.root_module.addImport("lmdb", lmdb);
Import the lmdb
module.
const lmdb = @import("lmdb");
For a unit test demonstrating basic usage of lmdb, see test.zig
. Run the test with zig build test
.