Looking at Bazel today for the first time.
On building the cpp tutorial, I can see how it builds simple executables and archive libraries, but it doesn't look like the examples create or use shared libraries.
Does anyone know of simple example BUILD files to demonstrate this process? Thanks.
A shared library is a cc_binary
:
cc_binary(
name = "libfoo.so",
srcs = ["foo.cc"],
linkshared = 1, ## important
)
(In non-trivial situations, you should probably also add linkstatic = 1
to get a self-contained DSO that does not itself have load-time dependencies on its source dependencies.)