caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Val_int vs caml_copy_nativeint
@ 2011-08-08  3:15 Erik de Castro Lopo
  2011-08-08  3:48 ` Romain Beauxis
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Erik de Castro Lopo @ 2011-08-08  3:15 UTC (permalink / raw)
  To: caml-list

Hi all,

I'm writing a C stub function to allow the calling of a C library
function from ocaml. The return from the stub is a tuple and I'm
doing this:

    /* Package up the result as a tuple. */
    v_response = caml_alloc_tuple (3) ;

    Store_field (v_response, 0, Val_int (width)) ;
    Store_field (v_response, 1, Val_int (height)) ;
    Store_field (v_response, 2, caml_copy_string (code)) ;

    CAMLreturn (v_response) ;

The above works now, but didn't work when I was using
caml_copy_nativeint() instead of Val_int() and I'd like to know
why. I found it especially confusing because caml_copy_string()
worked and was obvioulsy the right thing to do.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-08-10  6:43 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-08  3:15 [Caml-list] Val_int vs caml_copy_nativeint 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
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

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).