Common lib reference in dune

Hi,

I have the following project structure .

- My App
  -- common
      -- dune
      -- mylib.ml
      -- mylib.mli
  -- downloader
      -- dune
      -- main.ml
  -- decoder
     -- dune
     -- main.ml

How could i tell dune to use “common/mylib” from /downloader/main.ml and decoder/main.ml? Thanks.

Just add (libraries mylib) to the stanzas defining downloader and decoder.

Cheers,
Nicolas

1 Like

In common/dune, what is the name you give the common library? If you define it as (name common), you’ll want to do (libraries common) in the other dune files, and then reference the Mylib module in your OCaml code as Common.Mylib.

1 Like