Version française
Home     About     Download     Resources     Contact us    
Browse thread
ANNOUNCE : libsndfile-ocaml alpha
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] ANNOUNCE : libsndfile-ocaml alpha
On Sun, 2006-12-31 at 08:07 +1100, Erik de Castro Lopo wrote:

> The trouble interfacing with Ocaml is that Ocaml doesn't support 
> 16 bit shorts, 32 bit ints or 32 bit floats. The only data type that
> makes any sense is the Ocaml float type (C double).
> 
> So, I'd like to ask, if I provide a bigarray interface, how would it
> be used?

>From the manual:

type ('a, 'b) kind 
To each element kind is associated a Caml type, which is the type of
Caml values that can be stored in the big array or read back from it.
This type is not necessarily the same as the type of the array elements
proper: for instance, a big array whose elements are of kind float32_elt
contains 32-bit single precision floats, but reading or writing one of
its elements from Caml uses the Caml type float, which is 64-bit double
precision floats. 

The abstract type ('a, 'b) kind captures this association of a Caml type
'a for values read or written in the big array, and of an element kind
'b which represents the actual contents of the big array. The following
predefined values of type kind list all possible associations of Caml
types with element kinds:



-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net