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

Re: "ocaml_beginners"::[] How can I get struct types from C languages in Ocaml?

Expand Messages
  • Richard Jones
    ... The question isn t very clear. How do you want to access this expression from OCaml code .. Do you want to access it directly in memory? via a wrapper
    Message 1 of 3 , Aug 31, 2009
    • 0 Attachment
      On Mon, Aug 31, 2009 at 02:29:20PM -0000, mugerc wrote:
      > Hi ocaml people!
      >
      > I was faced problem.
      > That is...here is some C code:
      >
      > ----------------
      > sturct expression{
      > int typekind:3;
      > struct expression * expr1;
      > struct expression * expr2
      > };
      >
      > // another complex code...
      > ----------------
      >
      > I will do something with this code in ocaml.
      > how can i get a "expression" struct from C code to ocaml code? or
      > inter-operate?

      The question isn't very clear. How do you want to access this
      expression from OCaml code .. Do you want to access it directly in
      memory? via a wrapper function? From a file? Do you want to express
      the equivalent structure in OCaml (but not necessarily be compatible
      with C)?

      Depending on the answer, you could look at:

      - writing wrappers (see the other reply and
      http://caml.inria.fr/pub/docs/manual-ocaml-309/manual032.html)

      - possibly bitstring (http://code.google.com/p/bitstring/)
      particularly if the structure is held in a file

      - variants and record types in the OCaml manual
      http://caml.inria.fr/pub/docs/manual-ocaml/manual010.html

      Rich.

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