Suppose I have a library with top level APIs, and some modules I’d like to export, this works neatly with I put everything into a same dune library. (Note that I had my own mylib.ml
instead of dune generated wrapper, since I want to export only selected modules)
type t = ...
let my_function_1 = ...
module MyModule = MyModule
(** Some documentation *)
type t
val my_function_1 : ...
module MyModule = MyModule
This works fine if another library depends on mylib
, I can use MyModule
via MyLib.MyModule
and everything works.
However, when I have put things in multiple dune libraries, for instance the public library mylib
depends on the internal mylib.utils
library (assuming dune generates the wrapper). The re-exporting module becomes module MyModule = Utils.MyModule
.
When I access this re-exported MyModule
in a different library via MyLib.MyModule
, I get a compilation error saying MyLib.MyModule
is an alias for Utils.MyModule
which is missing.
I’ve tried to do the following things:
(1) Pass -linkall
to library_flags, not working
(2) In mylib.ml
, use module MyModule = struct include MyModule end
,
and in mylib.mli
, use module MyModule : sig include (module type of MyModule) end
, but the abstract types are broken
Any idea how to re-export modules in a multi-library layout correctly?
(I can provide an example repo if that helps)