Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] direct marshaling C<-->ML works in 3.05
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-31 (15:18)
From: Ohad Rodeh <ORODEH@i...>
Subject: Re: [Caml-list] direct marshaling C<-->ML works in 3.05
   In Ensemble that code was commented out, because the feature did not
entirely work in ocaml-3.04. I've just committed the change to CVS, so you
can take a look at it there.

   The idea is to take an ML memory-object  and marshal it directly to C
malloced buffers,
instead of  first converting it into a string using Marshal, and then
making a copy of it
to a C buffer. The reverse works the same way, except that you can get from
the network
an array of C-iovecs, and you'd like to unmarshal that, at low cost, into
an ML memory

    The basic code is in socket/s/mm.c, look for mm_input_val, and
These functions are used from socket/s/

    In ocaml terms, the basic supporting functions are (intext.h):

CAMLextern long output_value_to_block(value v, value flags,
                                      char * data, long len);
  /* Output [v] with flags [flags] to a user-provided memory buffer.
     [data] points to the start of this buffer, and [len] is its size
     in bytes.  Return the number of bytes actually written in buffer.
     Raise [Failure] if buffer is too short. */

CAMLextern value input_value_from_block(char * data, long len);
  /* Read a structured value from a user-provided buffer.  [data] points
     to the beginning of the externed data in this buffer,
     and [len] is the length in bytes of valid data in this buffer.
     The buffer is never deallocated by this routine. */

By now I've interfaced the C-Ensemble interface, with JNI, and I can tell
you that this feature is not supported in Java.



Ohad Rodeh
tel: +972-3-6401641
IBM Haifa, storage research

                      Brian Naylor                                                                                         
                      <bwv211mail@yahoo        To:       Ohad Rodeh/Haifa/IBM@IBMIL                                        
                      .com>                    cc:                                                                         
                                               Subject:  Re: [Caml-list] direct marshaling C<-->ML works in 3.05           
                      31/07/2002 17:53                                                                                     

Hi. Can you give me a reference for what you mean by 'direct marshalling'?
this somehow bypass the Marshal library? I have the Ensemble code base
a lot of it!) so I can follow a specific pointer if you have one. Thanks!

--- Ohad Rodeh <> wrote:
> Direct marshaling between ML memory-objects  and C io-vectors works great
> with the new release (3.05).

Do You Yahoo!?
Yahoo! Health - Feel better, live better

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: