Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 916 Bytes

bp_04_create_libraries.md

File metadata and controls

25 lines (20 loc) · 916 Bytes
id title short_title description category
creating-libraries
Creating Libraries to Structure a Project with Dune
Creating Libraries
How to create libraries with Dune
Best Practices

TL;DR

Add a library stanza in your dune file.

Creating a library with dune is as simple as adding a library stanza in your dune file:

(library
 (name <name>)
 (public_name <public_name>)
 (libraries <libraries...>))

Where <name> is the name of the library used inside internally, <public_name> is the name of the library used by users of the package and <libaries...> is the list of libraries to link to your library.

Note that if the library does not have a public_name, it will not be installed when installing the package through opam. As a consequence, you cannot use an internal library that does not have a public_name in a library or executable that has one.