English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    
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: -- (:)
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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners