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

OCaml-object direct method invocation (II)

Expand Messages
  • jackbergus
    Greetings everyone. Is it possible to pass OCaml-objects to C code and to execute there the methods that are inside it? I didn t find how to do that in the
    Message 1 of 3 , Jan 8, 2013
    • 0 Attachment
      Greetings everyone.

      Is it possible to pass OCaml-objects to C code and to execute there the methods that are inside it? I didn't find how to do that in the official manual:
      http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html

      Thanks in advance.

      G.B.
    • Lars Nilsson
      You probably want to use the function caml_get_public_method with caml_callback, found in mlvalues.h. The example in the header shows
      Message 2 of 3 , Jan 8, 2013
      • 0 Attachment
        You probably want to use the function caml_get_public_method with
        caml_callback, found in mlvalues.h. The example in the header shows
        caml_callback(caml_get_public_method(obj, caml_hash_variant(name)), obj). I
        am guessing the other caml_callback functions that take more arguments will
        work for method that takes arguments, with the first being the object, and
        the rest the arguments.

        Lars Nilsson
        On Jan 8, 2013 1:59 PM, "jackbergus" <giacomo.bergami@...> wrote:

        > **
        >
        >
        > Greetings everyone.
        >
        > Is it possible to pass OCaml-objects to C code and to execute there the
        > methods that are inside it? I didn't find how to do that in the official
        > manual:
        > http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html
        >
        > Thanks in advance.
        >
        > G.B.
        >
        >
        >


        [Non-text portions of this message have been removed]
      • jackbergus
        ... Thank you, I missed to look at that file.
        Message 3 of 3 , Jan 8, 2013
        • 0 Attachment
          >found in mlvalues.h.
          Thank you, I missed to look at that file.

          --- In ocaml_beginners@yahoogroups.com, Lars Nilsson wrote:
          >
          > You probably want to use the function caml_get_public_method with
          > caml_callback, found in mlvalues.h. The example in the header shows
          > caml_callback(caml_get_public_method(obj, caml_hash_variant(name)), obj). I
          > am guessing the other caml_callback functions that take more arguments will
          > work for method that takes arguments, with the first being the object, and
          > the rest the arguments.
          >
          > Lars Nilsson
          > On Jan 8, 2013 1:59 PM, "jackbergus" wrote:
          >
          > > **
          > >
          > >
          > > Greetings everyone.
          > >
          > > Is it possible to pass OCaml-objects to C code and to execute there the
          > > methods that are inside it? I didn't find how to do that in the official
          > > manual:
          > > http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html
          > >
          > > Thanks in advance.
          > >
          > > G.B.
          > >
          > >
          > >
          >
          >
          > [Non-text portions of this message have been removed]
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.