Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] interfacing C with Ocaml (beginner questions)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <Damien.Doligez@i...>
Subject: Re: [Caml-list] interfacing C with Ocaml (beginner questions)
>From: francois bereux <francois.bereux@fr.thalesgroup.com>

>I found a Double_val macro, but no Val_double. What is the solution ?

You must use copy_double (which will do the allocation) because
floating-point values are boxed in O'Caml.


>value add(value x, value y)
>{
>   CAMLparam2(x,y);
>   return Val_int(Int_val(x)+Int_val(y));
>}

This is wrong.  You must use CAMLreturn.

-- Damien
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr