caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Val_int vs caml_copy_nativeint
Date: Mon, 8 Aug 2011 10:03:56 +0200	[thread overview]
Message-ID: <20110808080356.GD29083@localhost> (raw)
In-Reply-To: <20110808174619.00b76d12a02f2c58c10c0108@mega-nerd.com>

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


  reply	other threads:[~2011-08-08  8:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08  3:15 Erik de Castro Lopo
2011-08-08  3:48 ` Romain Beauxis
2011-08-08  3:59   ` Guillaume Yziquel
2011-08-08  7:49     ` Erik de Castro Lopo
2011-08-08  3:53 ` Guillaume Yziquel
2011-08-08  7:46   ` Erik de Castro Lopo
2011-08-08  8:03     ` Guillaume Yziquel [this message]
2011-08-08  9:17       ` Mathias Kende
2011-08-08 17:24       ` Xavier Leroy
2011-08-09  1:33         ` Erik de Castro Lopo
2011-08-09  1:40           ` Romain Beauxis
2011-08-09  8:44           ` David Allsopp
2011-08-09 10:07             ` malc
2011-08-09 10:43               ` David Allsopp
2011-08-09 22:53           ` Erik de Castro Lopo
2011-08-10  6:43             ` Gabriel Scherer
2011-08-08  5:20 ` malc
2011-08-08  6:01   ` Guillaume Yziquel
2011-08-08  6:22     ` malc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110808080356.GD29083@localhost \
    --to=guillaume.yziquel@citycable.ch \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).