From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8AFD17ED99 for ; Mon, 25 May 2015 23:49:38 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of fabrissimo@gmail.com) identity=pra; client-ip=209.85.220.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of fabrissimo@gmail.com designates 209.85.220.181 as permitted sender) identity=mailfrom; client-ip=209.85.220.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qk0-f181.google.com) identity=helo; client-ip=209.85.220.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="postmaster@mail-qk0-f181.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BzAQD8l2NVlbXcVdFchEIGgxnJMAc8EAEBAQEBAQERAQEBAQcNCQkfMIQjAQEEEhEdATgBAwwBBQULDQICJgICIQESAQUBHAYTIod1AxKidj4xiz6EZJkwJw2FLAEFDoETihmCTYUnL4EWBZw+gVmQLIU5EiOBFVyBLSQcgVQ8MYJHAQEB X-IPAS-Result: A0BzAQD8l2NVlbXcVdFchEIGgxnJMAc8EAEBAQEBAQERAQEBAQcNCQkfMIQjAQEEEhEdATgBAwwBBQULDQICJgICIQESAQUBHAYTIod1AxKidj4xiz6EZJkwJw2FLAEFDoETihmCTYUnL4EWBZw+gVmQLIU5EiOBFVyBLSQcgVQ8MYJHAQEB X-IronPort-AV: E=Sophos;i="5.13,495,1427752800"; d="scan'208";a="127457316" Received: from mail-qk0-f181.google.com ([209.85.220.181]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 May 2015 23:49:37 +0200 Received: by qkdn188 with SMTP id n188so73999215qkd.2 for ; Mon, 25 May 2015 14:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=0D7on/LTYYutHVfmjdSEsnsqPYwHLlzVFxfPl4BLE68=; b=alWqFBdxfnS5JZXXfyzGweWJ719mO72tIfl96hFqI/CQinsgys1OmejtPo9kaWcQ// CpKtmBjlRt5o25AbpcJhEW7VV+NrBqrlL7xDQqwcYeomwrhIHQlqftKF/X55qFsUpM3G a6ziDOYW9sm6Ml9fZ9nXzy89uwPGQGOAHU4vfSmHDYYRfll6mX1WPmyDfFLAV8PsTI79 CPPI5sQw2J/En+EiyFe+90y0jqgh8mjex4eXj3lY0iJeNm3K8xUiSSPXfReeMdWUGY+f pwTTjavApcPjLelidKVrRxZkh1Sg3NyqURxPC4mnFzRG5gtEK/Z/3xU5iP5SYTlcdmUY X/Lg== X-Received: by 10.140.90.99 with SMTP id w90mr29217184qgd.57.1432590576382; Mon, 25 May 2015 14:49:36 -0700 (PDT) MIME-Version: 1.0 Sender: fabrissimo@gmail.com Received: by 10.96.92.228 with HTTP; Mon, 25 May 2015 14:49:16 -0700 (PDT) In-Reply-To: References: From: Fabrice Le Fessant Date: Mon, 25 May 2015 23:49:16 +0200 X-Google-Sender-Auth: 3zxlYsssicZ0bWQtcW4YGTmItD0 Message-ID: To: Jez Cc: Ocaml Mailing List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] When to (not) use -no-naked-pointers? Hi, Naked pointers only appear in C bindings when pointers to C structures are passed directly as OCaml values. Non-naked pointers are the ones which are hidden within either a custom block or a block with the "abstract" tag (Tag_abstract). It is normally easy to modify a binding to switch from naked-pointers to non-naked pointers (it could even be a configure script option of the binding). The only case where there is a (big) problem is when the binding is allocating OCaml values outside of the heap: it is the case for the "ancient" library, for example, that copies OCaml values outside of the heap to avoid garbage collections; it is also the case for some bindings that create OCaml string headers in front of C buffers, to be able to manipulate them directly in OCaml (I did that once to share OCaml strings between processes, using shared memory). --Fabrice INRIA &OCamlPro On Mon, May 25, 2015 at 8:25 AM, Jez wrote: > Hi, > > I noticed that 4.02 now has the no-naked-pointers option. I'd like to better > understand when I shouldn't use it -- i.e. what kinds of operations create > naked pointers? I suppose that these pointers can only be generated by C > code; an example of when their use may arise would be nice :) > > Jez -- Fabrice LE FESSANT Chercheur en Informatique INRIA Paris Rocquencourt -- OCamlPro Programming Languages and Distributed Systems