readme: fix build.zig example

As it turns out, it is important to link the C library also.
This commit is contained in:
torque 2023-09-10 13:00:40 -07:00
parent 0b7b5e4f54
commit 136ef10775
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk

View File

@ -55,10 +55,10 @@ pub fn build(b: *std.Build) void {
.root_source_file = .{.path = "my_cool_project.zig"},
});
my_program.addModule(
"nats",
b.dependency("nats", .{}).module("nats"),
);
const nats_dep = b.dependency("nats", .{});
my_program.addModule("nats", nats_dep.module("nats"));
my_program.linkLibrary(nats_dep.artifact("nats-c"));
b.installArtifact(my_program);
}