Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool / compiler-switches for reading out signatures from compiled files #6757

Closed
vicuna opened this issue Jan 20, 2015 · 5 comments
Closed

Comments

@vicuna
Copy link

vicuna commented Jan 20, 2015

Original bug ID: 6757
Reporter: oliver
Status: closed (set by @alainfrisch on 2015-12-02T15:41:51Z)
Resolution: won't fix
Priority: normal
Severity: feature
Platform: ./.
OS: ./.
OS Version: ./.
Version: 4.02.0
Category: ~DO NOT USE (was: OCaml general)

Bug description

With ocamlc -i foobar.ml
you get the signature of a ml-file.

To find out the signature of cmo-/cma-/cmxa-/.../-files
there seems to be no way.

Making it possible to get the signatures of such files
printed to stdout would be nice.

@vicuna
Copy link
Author

vicuna commented Jan 21, 2015

Comment author: @gasche

The .cmo/.cma themselves do not store typing information, it is in the .cmi for each individual module (.cmo has the implementation, not the interface). Each .cmo has a hash of the .cmi that it uses to check consistency: when you link foo.cmo, the compiler ensures that is exports the same interface that the other modules were compiled against.

Now let's assume your question is "how to see the interface of this foo.cmi" or "how to see the interface of foo.cmi which is somewhere in my include path": you may use ocp-browser for that purpose (opam install lambda-term ocp-index): "ocp-index -I ." will run with the standard include paths plus the current directory, and typing "Foo." will complete with the interface of module Foo.

(ocp-browser implements a rich command-line interface (thanks to lambda-term), there is also ocamlbrowser (opam install labltk) with the same features, but a Tk GUI.)

@vicuna
Copy link
Author

vicuna commented Jan 21, 2015

Comment author: @lpw25

I think that cmitomli (available in opam) also provides this feature.

@vicuna
Copy link
Author

vicuna commented Jan 21, 2015

Comment author: @gasche

Oliver, shall we consider this PR resolved then?

@vicuna
Copy link
Author

vicuna commented Feb 19, 2015

Comment author: oliver

OK; I looked at cmitomli, tried it out.

This is very helpful and can be used for my purposes.
Thanks for the hint.

(Nevertheless I think such a tool should be part of the original OCaml-distribution.)

@vicuna
Copy link
Author

vicuna commented Dec 2, 2015

Comment author: @alainfrisch

No strong need for the tool in the core distribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant