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
[Caml-list] OCaml popularity
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-13 (09:36)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] how to interface with integer Bigarrays using camlidl
> I posted this question on the beginner list, but I got no answer.
> I do not manage to interface a 1D Bigarray of integers with C code, using
> camlidl.
> [...]
> This expression has type
>    (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
> but is here used with type
>    (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t

You have to decide whether you want your bigarray to hold values of
type int32 (i.e. 32-bit integers) or int (i.e. Caml native integers --
31 bits on a 32-bit processor).

In the first case, change your IDL spec as follows:

void linear([in,ref] int* m,
            [in,out,length_is(*m),*int32,bigarray] int ia[] );

In the second case, change your Caml client code as follows:

let lin n =
   let ia = Array1.create int c_layout n in
      begin linear ia; ia; end;;

- Xavier Leroy

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