Is it safe to assume that
external foo: unit -> unit is resolved by the linker only when dune is building some actual executable file? Quick tests show that dune builds an OCaml library that is using some
external symbols that are not defined within that library without any issues. Can I rely on this behavior? Can such (incomplete linking-wise) dune library be installed into opam switch without any issues?
For context: I’m trying to solve Rust extension distribution problem. I want to delay the linking of rust bits until the final executable is being built. For that executable linking, I plan to create some tool, that will scrape opam dependencies of current project (i.e. .opam files in current git repo), fetch some custom metadata from opam manifests, that metadata will specify which crates at which versions need to be present to fulfill the external symbols - bake the list of crates required into some dummy crate that will re-export all symbols, link that crate into
.a archive, and feed that to OCaml for linking phase.