From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p783F7fI010043 for ; Mon, 8 Aug 2011 05:15:09 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUHAFVUP07Lzuai/2dsb2JhbABCmC+PB3eCAYFdo0GefYZGBJs4iEQ X-IronPort-AV: E=Sophos;i="4.67,335,1309730400"; d="scan'208";a="104912267" Received: from hendrix.mega-nerd.net ([203.206.230.162]) by mail4-smtp-sop.national.inria.fr with ESMTP; 08 Aug 2011 05:15:07 +0200 Received: from hendrix.mnn (hendrix.mnn [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id BFDD71067BC for ; Mon, 8 Aug 2011 13:15:04 +1000 (EST) Date: Mon, 8 Aug 2011 13:15:04 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Message-Id: <20110808131504.d9137220d4b4401cc3450e5a@mega-nerd.com> Reply-To: caml-list@inria.fr Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 3.2.0beta1 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Caml-list] Val_int vs caml_copy_nativeint 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/