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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 3A08B7F256 for ; Wed, 7 Nov 2012 16:54:59 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.80,730,1344204000"; d="scan'208";a="180543319" Received: from sympa.inria.fr ([193.51.193.213]) by mail1-relais-roc.national.inria.fr with ESMTP; 07 Nov 2012 16:54:59 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 27CDA7F257; Wed, 7 Nov 2012 16:54:59 +0100 (CET) To: caml-list@inria.fr Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7BIT From: X-Mailer: Sympa 6.1.7 Date: Wed, 7 Nov 2012 16:54:58 +0100 (CET) Subject: [Caml-list] C binding with labelled arguments Hi, If I have a C function like so: CAMLprim value stub_add_ints(value first, value second) { CAMLparam2(first, second); int sum; sum = Int_val(first) + Int_val(second); CAMLreturn(Val_int(sum)); } and I write an OCaml binding for it: external add_ints : int -> int -> int = "stub_add_ints" is there any way to give the OCaml function labelled arguments, other than writing a pure OCaml wrapper function? I'd like to be able to call add_ints ~first:3 ~second:4;; instead of just add_ints 3 4;; If I define the binding like this: external add_ints : first:int -> second:int -> int = "stub_add_ints" it compiles, but the labels seem to be ignored - calling the function with labelled arguments gives the error "This argument cannot be applied with label ~first", and looking up the function's type with OCamlSpotter indeed shows that the function's type has no label information. Thanks, John