GraalVM can build native shared libraries from Java or polyglot code. This functionality is integrated with these
rules, via the shared_library
target attribute on native_image
:
load("@rules_graalvm//:defs.bzl", "native_image")
java_library(
name = "example",
srcs = ["..."],
)
native_image(
name = "some_name",
shared_library = True,
deps = [
":example",
],
)
Even when building a shared library, GraalVM typically needs a main_class
. Instead of becoming a runnable entrypoint,
the main_class
is used by the Native Image compiler as the starting point for points-to analysis and code gen.
Alternatively, the @CEntryPoint
API can be used to define library entrypoints. See here for more information.