# Common lib reference in dune

**URL:** <https://discuss.ocaml.org/t/common-lib-reference-in-dune/8155>\
**Category:** Ecosystem\
**Tags:** dune\
**Created:** [July 17, 2021, 11:29am UTC](https://discuss.ocaml.org/t/common-lib-reference-in-dune/8155 "2021-07-17T11:29:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jazz](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jazz/32/4425_2.png) [@Jazz](https://discuss.ocaml.org/u/Jazz)\
**Post date:** [July 17, 2021, 11:29am UTC](https://discuss.ocaml.org/t/common-lib-reference-in-dune/8155/1 "2021-07-17T11:29:02Z")

</div>

Hi,

I have the following project structure .

```auto
- 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.

---

<div class="post-metadata">

**Author:** ![nojb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/nojb/32/519_2.png) [@nojb](https://discuss.ocaml.org/u/nojb)\
**Post date:** [July 17, 2021, 12:37pm UTC](https://discuss.ocaml.org/t/common-lib-reference-in-dune/8155/2 "2021-07-17T12:37:52Z")

</div>

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

Cheers,  
Nicolas

---

<div class="post-metadata">

**Author:** ![Levi\_Roth](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/levi_roth/32/2268_2.png) [@Levi\_Roth](https://discuss.ocaml.org/u/Levi_Roth)\
**Post date:** [July 17, 2021, 1:06pm UTC](https://discuss.ocaml.org/t/common-lib-reference-in-dune/8155/3 "2021-07-17T13:06:50Z")

</div>

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`.
