From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 5135CBC57 for ; Wed, 18 Aug 2010 20:47:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0CAIPHa0xbebk/Ymdsb2JhbACDGJ1BFwkMBxIhrnqSHIEigyJzBJQt X-IronPort-AV: E=Sophos;i="4.56,228,1280700000"; d="scan'208";a="57512283" Received: from 70.mail-out.ovh.net ([91.121.185.63]) by mail2-smtp-roc.national.inria.fr with SMTP; 18 Aug 2010 20:47:55 +0200 Received: (qmail 1670 invoked by uid 503); 18 Aug 2010 18:42:35 -0000 Received: from b9.ovh.net (HELO mail401.ha.ovh.net) (213.186.33.59) by 70.mail-out.ovh.net with SMTP; 18 Aug 2010 18:42:35 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 18 Aug 2010 20:47:55 +0200 Received: from ast-lambert-152-1-12-254.w82-124.abo.wanadoo.fr (HELO ?192.168.1.11?) (mathias@kende.eu@82.124.42.254) by ns0.ovh.net with SMTP; 18 Aug 2010 20:47:54 +0200 Subject: Re: [Caml-list] OCaml Int64 <-> C int64_t From: Mathias Kende To: Jianzhou Zhao Cc: caml-list@yquem.inria.fr In-Reply-To: References: <1282152997.21939.13.camel@mathias-ens> Content-Type: text/plain; charset="UTF-8" Date: Wed, 18 Aug 2010 20:47:52 +0200 Message-ID: <1282157272.10419.5.camel@mathias-ens> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 3087780496382891157 X-Ovh-Remote: 82.124.42.254 (ast-lambert-152-1-12-254.w82-124.abo.wanadoo.fr) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.500475/N X-Spam: no; 0.00; ocaml:01 camlprim:01 stub:01 alloc:01 camlparam:01 camlreturn:01 mathias:98 mathias:98 zhao:98 heap:01 caml-list:01 int:01 int:01 caml:02 caml:02 Le mercredi 18 août 2010 à 14:16 -0400, Jianzhou Zhao a écrit : > Does caml_copy_int64 do all I want? I believe so, but then I don't know what you want... > > int64_t C_fun(); > > CAMLprim value stub() > { > return (caml_copy_int64 (C_fun())); > } > > Do we still need I64_of_intnat? It is not included in > or other headers. INT64_of_intnat is an internal macro. There is no reason to use it. Your snippet of code seems correct, but remember that caml_copy_int64 will allocate values in the heap so you need to use the CAMLparam/CAMLreturn macro if your function receives arguments from the caml world.