How to use addTranslateC() in a build script in 0.16

It is documented how to assign the result of addTranslateC() to a const value. But then (obviously) I get a

build.zig:15:11: error: unused local constant
    const translate_c = b.addTranslateC(.{

After assigning this, how do I use this to build a shared library?

lib.root_module.addImport("cmodule_name", translate_c.createModule());
in your shared library .zig:
const cmodule_name = @import("cmodule_name");

3 Likes