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
How to read different ints from a Bigarray?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-10-28 (22:48)
From: blue storm <bluestorm.dylc@g...>
Subject: Re: [Caml-list] Re: How to read different ints from a Bigarray?
On Wed, Oct 28, 2009 at 6:57 PM, Goswin von Brederlow <> wrote:
> Maybe ideal would be a format string based interface that calls C with
> a format string and a record of values. Because what I really need is
> to read/write records in an architecture independend way. Something
> like
> type t = { x:int; y:char; z:int64 }
> let t_format = "%2u%c%8d"
> put_formated buf t_format t
> But how to get that type safe? Maybe a camlp4 module that generates
> the format string and type from a single declaration so they always
> match.

It's possibly off-topic, but you might be interested in Richard
Jones's Bitstring project [1] wich deals with similar issues quite
nicely in my opinion.