Loading ...
Sorry, an error occurred while loading the content.

Inspecting cmi (or cma) files

Expand Messages
  • cedric cellier
    Hi list ! I m fresh new to Ocaml, and have some practical issues with the language. First, I was wondering if someone knows of a way to look into cmi or cma
    Message 1 of 5 , Apr 1, 2008
    • 0 Attachment
      Hi list !

      I'm fresh new to Ocaml, and have some practical issues with the
      language.

      First, I was wondering if someone knows of a way to look into cmi or cma
      files for a list of defined modules (equivalent to the unix 'nm' command
      for libraries or object files).

      I had to use the 'strings' command against the various eliom cma files
      to find out why the Eliom tutorial was not compilable (apparently,
      modules were renamed from Eliom_services etc to Eliomservices etc).

      Do someone knows of any 'module' browser or of a tool of some sort able
      to decipher cmi/cma files ?

      Sorry if it's obvious. My experience as a C programmer probably don't
      help much :)
    • Hezekiah M. Carty
      ... ocamlbrowser will give you at least some of what you want. Depending on where the .cm* files in question are, you can use: ocamlbrowser -I
      Message 2 of 5 , Apr 1, 2008
      • 0 Attachment
        On Tue, Apr 1, 2008 at 8:27 AM, cedric cellier <rixed@...> wrote:
        >
        > Hi list !
        >
        > I'm fresh new to Ocaml, and have some practical issues with the
        > language.
        >
        > First, I was wondering if someone knows of a way to look into cmi or cma
        > files for a list of defined modules (equivalent to the unix 'nm' command
        > for libraries or object files).
        >
        > I had to use the 'strings' command against the various eliom cma files
        > to find out why the Eliom tutorial was not compilable (apparently,
        > modules were renamed from Eliom_services etc to Eliomservices etc).
        >
        > Do someone knows of any 'module' browser or of a tool of some sort able
        > to decipher cmi/cma files ?
        >
        > Sorry if it's obvious. My experience as a C programmer probably don't
        > help much :)
        >

        ocamlbrowser will give you at least some of what you want. Depending
        on where the .cm* files in question are, you can use:

        ocamlbrowser -I /location/of/files/

        That should let you browse the contents of the standard library in
        addition to the library with files in /location/of/files/

        Hez

        --
        Hezekiah M. Carty
        Graduate Research Assistant
        University of Maryland
        Department of Atmospheric and Oceanic Science
      • cedric cellier
        Thank you for all the quick replies ! If I had suspected there was already something that close to what I wanted I would have googled it :)
        Message 3 of 5 , Apr 1, 2008
        • 0 Attachment
          Thank you for all the quick replies !

          If I had suspected there was already something that close to what I wanted
          I would have googled it :)
        • William D. Neumann
          On Tue, 1 Apr 2008 08:39:02 -0400, Hezekiah M. Carty wrote ... There s also cmigrep though if I remember correctly, it has a
          Message 4 of 5 , Apr 1, 2008
          • 0 Attachment
            On Tue, 1 Apr 2008 08:39:02 -0400, Hezekiah M. Carty wrote
            > On Tue, Apr 1, 2008 at 8:27 AM, cedric cellier
            > <rixed@...> wrote:

            > > Do someone knows of any 'module' browser or of a tool of some sort able
            > > to decipher cmi/cma files ?
            > >
            > > Sorry if it's obvious. My experience as a C programmer probably don't
            > > help much :)
            > >
            >
            > ocamlbrowser will give you at least some of what you want. Depending
            > on where the .cm* files in question are, you can use:
            >
            > ocamlbrowser -I /location/of/files/
            >
            > That should let you browse the contents of the standard library in
            > addition to the library with files in /location/of/files/

            There's also cmigrep <http://homepage.mac.com/letaris/> though if I remember
            correctly, it has a dependency on GODI.

            William D. Neumann

            --

            William D. Neumann
          • Richard Jones
            ... In Debian and Fedora there is a program which is installed called ocamlobjinfo which does what you want. This program comes from the main OCaml
            Message 5 of 5 , Apr 1, 2008
            • 0 Attachment
              On Tue, Apr 01, 2008 at 02:27:45PM +0200, cedric cellier wrote:
              > First, I was wondering if someone knows of a way to look into cmi or cma
              > files for a list of defined modules (equivalent to the unix 'nm' command
              > for libraries or object files).

              In Debian and Fedora there is a program which is installed called
              'ocamlobjinfo' which does what you want.

              This program comes from the main OCaml distribution where IIRC it was
              called tools/objinfo, but you have to compile it specially.

              > Do someone knows of any 'module' browser or of a tool of some sort able
              > to decipher cmi/cma files ?

              For the general question about 'module browsing', I usually find the
              best bet is to look directly at the *.mli files in /usr/lib/ocaml.

              Rich.

              --
              Richard Jones
              Red Hat
            Your message has been successfully submitted and would be delivered to recipients shortly.