From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 2F14E820A1 for ; Thu, 22 Aug 2013 10:44:15 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.128.83; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of dra-news@metastack.com designates 62.13.128.83 as permitted sender) identity=mailfrom; client-ip=62.13.128.83; receiver=mail2-smtp-roc.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 (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@outmail128083.authsmtp.net) identity=helo; client-ip=62.13.128.83; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail128083.authsmtp.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgELAOfOFVI+DYBT/2dsb2JhbABagmQhNVGrUAOUMYEdFm0HgiQBAQEDAScTRAsCAQgYChQQMiUCBBuIAgcDrxqQNTiDG3sDl2aBLZAtgx+CKw X-IPAS-Result: AgELAOfOFVI+DYBT/2dsb2JhbABagmQhNVGrUAOUMYEdFm0HgiQBAQEDAScTRAsCAQgYChQQMiUCBBuIAgcDrxqQNTiDG3sDl2aBLZAtgx+CKw X-IronPort-AV: E=Sophos;i="4.89,932,1367964000"; d="scan'208";a="30031042" Received: from outmail128083.authsmtp.net ([62.13.128.83]) by mail2-smtp-roc.national.inria.fr with ESMTP; 22 Aug 2013 10:44:13 +0200 Received: from mail-c235.authsmtp.com (mail-c235.authsmtp.com [62.13.128.235]) by punt14.authsmtp.com (8.14.2/8.14.2) with ESMTP id r7M8iDvY034852 for ; Thu, 22 Aug 2013 09:44:13 +0100 (BST) Received: from romulus.metastack.com (cpc1-cmbg5-0-0-cust241.5-4.cable.virginmedia.com [81.98.252.242]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id r7M8i8l5048618 for ; Thu, 22 Aug 2013 09:44:08 +0100 (BST) 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 r7M8i8Gs014229 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Thu, 22 Aug 2013 09:44:08 +0100 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.0158.001; Thu, 22 Aug 2013 09:44:07 +0100 From: David Allsopp To: "caml-list@inria.fr" Thread-Topic: [Caml-list] external function with arity > 5 and "noalloc" Thread-Index: AQHOnozodNQiJ/XM6EeFC+hUGYkIspmg6D9g Date: Thu, 22 Aug 2013 08:44:06 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [91.47.9.4] 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: 02c1ed27-0b07-11e3-b5c5-002590a15da7 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNlEAUAAU NkdBMnJSNkcdTBdX QSgJWUslFQpuW2N0 aBpRZA9ZZkBOVkti UVZASkxQEQd2AxgD GRwbTRk8NQI7cCd4 OUNiWnhdXUw0dkd0 RQBUFz4HMDNib30f AkBfagJVJQBXLBoW b01/VHEIaGVWZ380 FlAlBR1jdQZ0ISFR BwUMNk4nCUsbAjMm QRkGVTsyG0YZRiI1 ZwMnNl5UFVwQLlR6 ZxN8EVseP1dYDApX G0VKC2Ux X-Authentic-SMTP: 61633634383431.1023: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] external function with arity > 5 and "noalloc" Florent Monnier wrote: > Hi, >=20 > I'm not sure if this behavior is a bug or not. > Here a given function defined in a stub: >=20 > cat > bind.ml < external f : > v1:int -> > v2:int -> > v3:int -> > v4:int -> > v5:int -> > v6:int -> int > =3D "bind_f" > "bind_f_bc" > "noalloc" > EOF The naming you're using here implies you've got these the wrong way around = - the bytecode stub comes first (I'm assuming that's what _bc means) - see = 19.1.2 in the manual. > if compiles fine with all warnings on: > ocamlopt -c -w +A -warn-error +A bind.ml >=20 > if will also compile fine with: > =3D "bind_f" > "bind_f_bc" >=20 > if I put only: > =3D "bind_f" >=20 > I get a compilation error, which is what I expected: >=20 > ocamlopt -c -w +A -warn-error +A bind.ml >=20 > File "bind.ml", line 2, characters 2-75: > Error: An external function with more than 5 arguments requires > a second stub function for native-code compilation >=20 >=20 > But now if I write this way: > =3D "bind_f" > "noalloc" > then I get no compile error anymore. This isn't a bug - are you able to link the executable? What you've specifi= ed is an external f using a function bind_f for bytecode and noalloc for na= tive code - unless there is a symbol noalloc knocking around somewhere in t= he runtime, I'd expect you to get a linking error with ocamlopt and either = a linking error or a runtime segfault with ocamlc (because of using bind_f = not bind_f_bc). "noalloc" as a string rather than a keyword is a bit of a hack (though I'm = sure there's a logical reason it was done that way - although it does just = look a teensy bit lazy as it means the grammar for external is simply a str= ing list!). What is a bug is that noalloc isn't mentioned in Chapter 19 of = the manual (similarly for "float" which can also be specified). David=20