Check console signature library (.cma)

Say I have an OCaml foo.cma library file. Is there a command line tool for printing signatures of functions and other types defined there? The ocamlbrowser utility seems to be Windows-based (complaining about the $ DISPLAY environment variable). A use case is what I am doing:

ocamlc -c foo.cma main.ml 

and get:

 File "main.ml", line 13, characters 33-47: Error: Unbound value ListUtil.split 

ListUtil.split should be in foo.cma, but I don’t know a console tool to check it.

+6
source share
3 answers

In Debian / Ubuntu you have "ocamlobjinfo":

 ocamlobjinfo stdlib.cma 

will display all device names included in stdlib.cma. Then you can create a short file:

 include SomeModule 

and compile it with -i to find out what is defined in the SomeModule module.

+9
source

At the top, I just upload the cma file:

 #load "foo.cma";; 

Then I redefined the module to see the signature:

 module Chunk = Foo;; 
+5
source

To compile code referencing ListUtil.split , the compiler must find the corresponding listUtil.cmi file. To link this code compiler, you need a cma (or cmo) file containing the implementation. See http://mirror.ocamlcore.org/caml.inria.fr/pub/ml-archives/caml-list/2008/09/2bc9b38171177af5dc0d832a365d290d.en.html for an explanation.

+2
source

Source: https://habr.com/ru/post/911089/


All Articles