I'm just starting a project to analyze C programs using goblint-cil.
I know I needed to use a library to import it. The README for goblint-cil says the following:
# #use "topfind";;
# #require "goblint-cil";;
# GoblintCil.cilVersion;;
- : string = "2.0.3"
I then made a dune file requiring it:
(executable
(libraries goblint-cil)
(name main))
I have two basic questions about libraries in Ocaml:
- How do I find out what modules a library or package provides? In the case of
GoblintCil
it was right there in the README, but I would like to know if this library provides any other modules. - What is the relation between libraries, packages, and modules? It seems to me the following are true:
- Every .ml file forms a module by capitalizing it
- Packages are just a collection of libraries and (potentially empty) set of executables
- Libraries are a sub-collection of modules in a package
Are these correct?
You can:
read the documentation of the package:
In a toplevel, once you have loaded a library with
#require "library_name"
, you can#show
its toplevel module: