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 AF8D7BBAF for ; Mon, 23 Aug 2010 14:59:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmYFAPsMckyK54gDgWdsb2JhbACDF5AOjQgVAQEWIiKnTJFVgSKDInMEiXY X-IronPort-AV: E=Sophos;i="4.56,257,1280700000"; d="scan'208";a="57686524" Received: from rouge.crans.org ([138.231.136.3]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 23 Aug 2010 14:59:31 +0200 Received: from localhost (localhost.crans.org [127.0.0.1]) by rouge.crans.org (Postfix) with ESMTP id 18A9E8285 for ; Mon, 23 Aug 2010 14:59:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at crans.org Received: from rouge.crans.org ([10.231.136.3]) by localhost (rouge.crans.org [10.231.136.3]) (amavisd-new, port 10024) with LMTP id paABmVdlqO2F for ; Mon, 23 Aug 2010 14:59:31 +0200 (CEST) Received: from [192.168.39.1] (fbx.up7.fr [88.185.141.188]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rouge.crans.org (Postfix) with ESMTPSA id E5B9F8073 for ; Mon, 23 Aug 2010 14:59:30 +0200 (CEST) Message-ID: <4C7270A7.4070803@crans.org> Date: Mon, 23 Aug 2010 14:59:19 +0200 From: =?UTF-8?B?U3TDqXBoYW5lIEdsb25kdQ==?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100805 Icedove/3.0.6 MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] caml_copy_string References: <201008231409.06024.monnier.florent@gmail.com> In-Reply-To: <201008231409.06024.monnier.florent@gmail.com> X-Enigmail-Version: 1.0.1 OpenPGP: id=49881AD3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; ocaml:01 ocaml:01 buffer:01 allocations:01 buffer:01 pointer:01 bigarrays:01 phane:98 crans:98 phane:98 caml-list:01 caml:02 caml:02 string:02 string:02 Le 23/08/2010 14:09, Florent Monnier a =C3=A9crit : >> Is there a way to get a string from C to OCaml without the caml_copy_s= tring >> function, or is there a version that doesn't copy the string? >=20 > an alternative method is to provide a string from ocaml to c then c fil= ls this=20 > buffer, then you can save allocations by reusing the same buffer, see: = [...] You can also wrap your C pointer into bigarrays. --=20 St=C3=A9phane