- Functional wrappers providing for every use case covered by lmdb
see /examples/
- First, fetch the package:
zig fetch --save=lmdb git+https://github.com/zxcv05/lmdb-zig - Then, modify your
build.zig:
//! build.zig
const lmdb_dep = b.dependency("lmdb", .{ .target = target, .optimize = optimize });
const lmdb_mod = lmdb_dep.module("lmdb"); // for wrappers
const lmdb_lib = lmdb_dep.artifact("lmdb"); // for linking (ignore this if you want to use system-installed library instead)
// ...
my_module.addImport("lmdb", lmdb_mod);
my_exe.linkLibrary(lmdb_lib);
// OR, to use system-installed library instead:
my_exe.linkSystemLibrary("lmdb");- Finally, you can use lmdb in your project
//! my-file.zig
const lmdb = @import("lmdb");
// See `/examples/` for help with usage
pub fn my_func() !void {
const env: lmdb.Env = try .init("my-lmdb-env/", .{});
defer env.deinit();
// ...
}As long as you're not using the system-installed library, you can freely control when tracing is enabled
- In your
build.zig, all you need to change is the following line:
const lmdb_dep = b.dependency("lmdb", .{ .target = target, .optimize = optimize, .@"use-tracing" = true });- zig wrappers available as module
lmdb - translated
liblmdbheaders available as modulec - compiled
liblmdbstatic library available as artifactlmdb - available options:
-Dno-install: For default step, build but don't installliblmdb(default: false)-Duse-tracing: Buildliblmdbstatic library with debug tracing enabled (default: false)-Dno-run: Forteststep, build but don't run unit tests (default: false)-Dtest-filter='x': Forteststep, filter which tests are run based onx-Dtests-use-system-lib: Forteststep, use system installedliblmdblibrary instead of the one we build (default: false)
This project is subject to the terms of the OpenLDAP Public License v2.8 (See LICENSE)
Copyright 2025 lmdb-zig contributors