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 6D0737EC6E for ; Thu, 2 Jan 2014 11:22:08 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.149.82; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of dra-news@metastack.com designates 62.13.149.82 as permitted sender) identity=mailfrom; client-ip=62.13.149.82; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.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@outmail149082.authsmtp.co.uk) identity=helo; client-ip=62.13.149.82; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail149082.authsmtp.co.uk"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApcBAO48xVI+DZVSnGdsb2JhbAA+EAqCallVuHWBDBYOAQEBAQEIFAk8giUBAQEDATpECwIBCBgKFBAyJQEBBBuHdAkDCTbBeheOQSs4gyOBEwSYF4EwlBGCKg X-IPAS-Result: ApcBAO48xVI+DZVSnGdsb2JhbAA+EAqCallVuHWBDBYOAQEBAQEIFAk8giUBAQEDATpECwIBCBgKFBAyJQEBBBuHdAkDCTbBeheOQSs4gyOBEwSYF4EwlBGCKg X-IronPort-AV: E=Sophos;i="4.95,590,1384297200"; d="scan'208";a="43228154" Received: from outmail149082.authsmtp.co.uk ([62.13.149.82]) by mail3-smtp-sop.national.inria.fr with ESMTP; 02 Jan 2014 11:22:07 +0100 Received: from mail-c237.authsmtp.com (mail-c237.authsmtp.com [62.13.128.237]) by punt14.authsmtp.com (8.14.2/8.14.2) with ESMTP id s02AM62I031122 for ; Thu, 2 Jan 2014 10:22:06 GMT Received: from romulus.metastack.com (cpc1-cmbg5-0-0-cust241.5-4.cable.virginm.net [81.98.252.242]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id s02AM2Ka045340 for ; Thu, 2 Jan 2014 10:22:02 GMT Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id s02AM21j010866 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Thu, 2 Jan 2014 10:22:02 GMT Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0174.001; Thu, 2 Jan 2014 10:22:01 +0000 From: David Allsopp To: OCaml List Thread-Topic: [Caml-list] Libraries exporting external definitions in modules Thread-Index: Ac8DBOOEhiNNiVCzT2ux7GEWcUW+5gA1d6CAAPG9kjA= Date: Thu, 2 Jan 2014 10:22:01 +0000 Message-ID: References: <000001cf0307$75fa3520$61ee9f60$@metastack.com> <1388241631.2837.7.camel@e130> In-Reply-To: <1388241631.2837.7.camel@e130> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.0.18] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: b8c4f49a-7397-11e3-94fa-002590a135d3 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNlEAUAAU NkdBMnJSNkcdTBdX QSgLWUsuAQNuW2N0 bxpQbQ9fYEBOXUti UVZASkxQEQd2AxgD GRwbTRk8NAVECQNy HhdiWnVYWEQ0d096 QAAGHT4CM2NpOX0Y U0lfagJVJQBXdxsT O01/VHEIaGVWZ3ll E1QlBR1jdQZ0ISFR BwUMNk4nCWIKFCQ1 XREPBn0iDVUCXTky KRNuJ04AEVwXO0F6 PVYvWFQZLx4VDBYW HkcFBShVOl0MXEIA X-Authentic-SMTP: 61633634383431.1024:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 81.98.252.242/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: RE: [Caml-list] Libraries exporting external definitions in modules Thanks for the replies! Gerd Stolpmann wrote: > There is an easy workaround: Don't put the external declaration into the > mli, just a val. When installing the library, take care to also include > the cmx file. This way, the extra function wrapper can be eliminated by > the automatic inliner of ocamlopt. Ah, I didn't realise that that was one of the optimisations which installin= g the .cmx file allows. In fact, that seems to be a good case for *never* u= sing external in the .cmi file, as that way you have transparent control ov= er a future version which just might need to put an OCaml wrapper around th= e stub. > Of course, this works only for native code. True, but the introduction of native dynlink (on most platforms, at least) = does seem to make worrying about very small optimisations (i.e. non-algorit= hmic) for bytecode silly :o) Markus Mottl wrote: > This bug report also describes this problem: > http://caml.inria.fr/mantis/view.php?id=3D4166 ocamldoc/trunk/manual/cmds/intf-c.etex was updated by Damien at the end of = November with a warning in the explanation of the [external] keyword that t= his can happen (was glad I spotted that *before* attaching a documentation = patch to your PR!) > I think this should get fixed. Though there is an easy (though slightly > less efficient) workaround, this problem is pretty hard to identify, > especially for people who have never seen it. Judging by Jacques note connecting it to PR#6063 it will be soon - though g= iven that installing the .cmx files enables the optimisation as well, I'm w= ondering if never using [external] in .mli files is actually the better rou= te? David