Version française
Home     About     Download     Resources     Contact us    
Browse thread
Double+Int Records (C-Interface) and Double_array_tag
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Double+Int Records (C-Interface) and Double_array_tag
On Thu, Jan 19, 2006 at 11:24:54AM +0100, Bauer, Christoph wrote:
> given a type like
> 
> type t = {
>    i : int;
>    f0 : float;
>    f1 : float;
>    ...
>    f100 : float;
> }
> 
> A value from this type is constructed in C-code. Is
> it possible to create a block with a Double_array_tag?
> (Because there are only unboxed values in this record.)

On a 32 bit machine, the int is 4 bytes long and the floats are 8
bytes long, so the floats wouldn't be aligned.  How about simply:

type t = {
  i : int;
  f : float array;
}

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com