Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=19b5b963c21b6fe98d2f62e404e53611c3bcc7baf538efd01f598ef928257aae
sha512=bfb47467967e662e22163de0714642eb3a4cec05c85e0d76b0a5eebe75e2d3b1a3273432b58e1e4ab078026597182dd9d517832405bf00ef02d7751d0b3c9ece
Description
Cmdliner-stdlib is a package that provides a collection of cmdliner terms to control the OCaml runtime parameters. This is typically done with environment variables, but there are situations where such an environment is not accessible, like in MirageOS. This package enables the configuration and manipulation of runtime parameters in these contexts, improving the flexibility of applications built on these platforms.
README
cmdliner-stdlib
The cmdliner-stdlib package is a collection of cmdliner terms that help control OCaml runtime parameters, usually configured through the OCAMLRUNPARAM environment variable. The package provides command-line options for controlling features like backtrace, hash table randomization, and garbage collector tuning.
Installation
You can install the package using opam:
opam install cmdliner-stdlibUsage
You can use these command-line arguments to:
- enable/disable backtraces;
- enable/disable table randomization, for better security and prevent collision attacks; and
- control the OCaml garbage collector as described in detail in the GC control documentation.
open Cmdliner
let cmd = Cmd.v (Cmd.info "hello") (Cmdliner_stdlib.setup ())
let () = exit (Cmd.eval cmd)You can then use command-line options to change parameters of the OCaml runtime. For instance, to enable backtraces and change the GC allocation policy to "first fit":
$ dune exec -- ./hello.exe --allocation-policy=first-fit --backtrace=trueYou can disable some of these arguments. For instance, to disable GC control use:
Cmdliner_stdlib.setup ~gc_control:None ()Or to change the default allocation policy to be first-fit:
let default = Gc.get () in
let gc_control = Some { default with allocation_policy = 1 } in
Cmdliner_stdlib.setup ~gc_control ()Contributions
We welcome contributions, bug reports, and feature requests. Please visit our GitHub repository for more information.
Dev Dependencies
None
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building cmdliner-stdlib with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 1.0.1 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure