Is it possible open a module for all files in a dune library or dune project?

Let’s say I want to open Base for all files in a dune library or a dune project. Do I have to say open Base in every file or can I tell dune somehow to open Base automatically for all files?

Yes, using ocamlc -open Base

In dune you can use it for all your project by adding this line to the dune file in the root directory or the topmost directory that you want:

(env (_ (flags (:standard -open Base))))
5 Likes