Say I run dune init proj hello_world, then modify the bin/dune and bin/main.ml files so that a new dependency foobar is in use.
The bin/dune file now:
(executable
(public_name hello_world)
(name main)
(libraries hello_world foobar))
1. How can I specify that the foobar library should have a certain exact version?
2. If we know that the foobar library uses semantic versioning, how could I specify that any version with the major version as 3 is required?
ocaml version 4.14.0
dune version 3.6.1
Package dependencies for a project are specified in the dune-project file, see https://dune.readthedocs.io/en/stable/dune-files.html#package
A default dune-project file is generated by dune init proj ....
To add a dependency with a version constraint, add a line in the depends field like
(depends
(foobar (>= 3))
Note that this is needed in addition to specifying which libraries the executable component depends on, which is what you have on the bin/dune file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With