Version française
Home     About     Download     Resources     Contact us    
Browse thread
Give back a Pair from C to OCaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Berke Durak <berke.durak@e...>
Subject: Re: [Caml-list] Give back a Pair from C to OCaml?
Oliver Bandel a écrit :
> Hello,
> 
> how can I give back a pair of values (in my case both are
> int's) from C to OCaml?
> 
> Didn't found something in the docs so far.
> 

Just allocate a block of size two and store your integers in the two 
fields of the block.

pairv = caml_alloc(2, 0);
Store_field(pairv, 0, Val_int(x));
Store_field(pairv, 1, Val_int(y));

-- 
Berke DURAK