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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id AE2757F256 for ; Wed, 7 Nov 2012 18:02:17 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of john.else@citrix.com) identity=pra; client-ip=62.200.22.115; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="john.else@citrix.com"; x-sender="john.else@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of john.else@citrix.com designates 62.200.22.115 as permitted sender) identity=mailfrom; client-ip=62.200.22.115; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="john.else@citrix.com"; x-sender="john.else@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of postmaster@SMTP.EU.CITRIX.COM designates 62.200.22.115 as permitted sender) identity=helo; client-ip=62.200.22.115; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="john.else@citrix.com"; x-sender="postmaster@SMTP.EU.CITRIX.COM"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At0AAKmSmlA+yBZzmWdsb2JhbABEsT2SIyMBAQEBAQgLCwcUJ4IeAQEFJxM0CwwEAgEIEQQBAQ4RCQchERMBCQgBAQQOBQgKh2YDEweyegMKiVSLJGmFZmEDlCaCcYoXiAA X-IronPort-AV: E=Sophos;i="4.80,730,1344204000"; d="scan'208";a="161711098" Received: from smtp.eu.citrix.com ([62.200.22.115]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Nov 2012 18:02:16 +0100 X-IronPort-AV: E=Sophos;i="4.80,730,1344211200"; d="scan'208";a="15647402" Received: from lonpmailmx01.citrite.net ([10.30.203.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP/TLS/RC4-MD5; 07 Nov 2012 17:02:12 +0000 Received: from LONPMAILBOX01.citrite.net ([10.30.224.161]) by LONPMAILMX01.citrite.net ([10.30.203.162]) with mapi; Wed, 7 Nov 2012 17:02:11 +0000 From: John Else To: Florent Monnier CC: "caml-list@inria.fr" , "gabriel.scherer@gmail.com" Date: Wed, 7 Nov 2012 17:02:58 +0000 Thread-Topic: Re: [Caml-list] C binding with labelled arguments Thread-Index: Ac29Bqg5bwDo7wkjRTKhaQ+FZEeC/wAAsvKg Message-ID: <7EA643C653F17F4C80DE959E978F10EDFA0FFFB77C@LONPMAILBOX01.citrite.net> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: Re: [Caml-list] C binding with labelled arguments Hi Florent, That also works for me - not sure what I was doing wrong before. I'll go back and experiment on my "real" code. Thanks all! John -----Original Message----- From: Florent Monnier [mailto:monnier.florent@gmail.com]=20 Sent: 07 November 2012 16:41 To: John Else Cc: caml-list@inria.fr; gabriel.scherer@gmail.com Subject: Re: Re: [Caml-list] C binding with labelled arguments Hi, I cannot reproduce your error, for me it compiles fine: $ cat foo_stub.c foo.ml #include #include CAMLprim value stub_add_ints(value first, value second) { CAMLparam2(first, second); int sum; sum =3D Int_val(first) + Int_val(second); CAMLreturn(Val_int(sum)); } external add_ints : first:int -> second:int -> int =3D "stub_add_ints" let () =3D let res =3D add_ints ~first:3 ~second:4 in print_int res; print_newline () $ ocamlopt -o foo.opt foo.ml foo_stub.c $ ./foo.opt 7 --=20 2012/11/7, john.else@citrix.com : > Hi Gabriel, > > I agree it'd be better to use labelled arguments than not, for safety=20 > as you suggest. I was just wondering if there was a way to add=20 > labelled arguments directly to the external, rather than requiring a=20 > wrapper function to add the labels. > > John > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >