Le Monday 08 Aug 2011 à 17:46:19 (+1000), Erik de Castro Lopo a écrit :
> Guillaume Yziquel wrote:
>
> > What do you mean by "doesn't work" precisely?
>
> The integer value I assign in the C file (and print out for a
> sanity check) ends up as what looks like an address in the
> Ocaml code.
>
> Erik
Then I do not see anything wrong if the code snippet you sent. However,
when you change Val_int to caml_copy_nativeint, the layout of the tuple
is different.
With Val_int, you have an integral value in the tuple's field.
With caml_copy_nativeint, you have a pointer in the tuple's field.
So if you keep the same OCaml code when reading the result value, it's
no surprise that the pointer is shown in place of the integer you
expected.
But this is just guessing.
--
Guillaume Yziquel
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs