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: Florent Monnier <fmonnier@l...>
Subject: Re: [Caml-list] Give back a Pair from C to OCaml?
Hi,
> > Recently I've written a small tutorial about wrapping ocaml to C,
> > maybe you could find it usefull:
> > http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php
>
> [...]
>
> You mentioned a "Double_wosize" in your tutorial,
> but I can't find such a thing in the reference manual.

Yes indeed, the macro Val_emptylist is not either in the manual, but if you 
read the caml header files, you will find both of these macro. You can safely 
use both of them in your project.

> Possibly you mean something like
>       Wosize_val(Double_field(ml_array, 0))
> ???
> Would that work?
I don't know, I haven't tryed.

But for the "Double_wosize" macro, you can trust, I have asked on the other 
ocaml list, so there's no problem there. And a lot of ocaml wrappers use it.

> Does int- and floats really need such a distinction?!

Yes, float arrays are not handle in the same way than the other values.
(it's explained in the manual.)

When I had read this part of the ocaml manual, I haven't found it very easy to 
understand, so that's why I thought perhaps it is the same for other people, 
and why I have tryed to make this little tutorial.

Regards