Open aherrmann opened 1 year ago
I'm also looking to do what https://github.com/aherrmann/rules_zig/issues/146 wants. I want to link a cc_library to a zig_binary (or library or test). Also, ideally I would be able to include headers from those cdeps
. I'm trying to make https://github.com/nodecum/c-toxcore-zig which depends on https://github.com/TokTok/c-toxcore work in bazel.
Linking against static libraries is now supported with https://github.com/aherrmann/rules_zig/issues/162. Shared library dependencies are a bit more complicated, see https://github.com/aherrmann/rules_zig/pull/165.
Zig has two different ways to link against pre-built objects or libraries. Either, by passing the corresponding files on the command-line, in which case they are passed as file paths to the underlying linker, or by passing
-l
type flags, in which case they are looked up in the library search paths and either resolved to files or forwarded as-l
type flags to the underlying linker.