From: Florent Monnier <monnier.florent@gmail.com>
To: john.else@citrix.com
Cc: caml-list@inria.fr, gabriel.scherer@gmail.com
Subject: Re: Re: [Caml-list] C binding with labelled arguments
Date: Wed, 7 Nov 2012 17:40:42 +0100 [thread overview]
Message-ID: <CAE1DttA6xKFjR9jPgAQVyhnHEMReiWtgHoNerRGivine+AOuoA@mail.gmail.com> (raw)
In-Reply-To: <sympa.1352305326.12138.840@inria.fr>
Hi,
I cannot reproduce your error, for me it compiles fine:
$ cat foo_stub.c foo.ml
#include <caml/mlvalues.h>
#include <caml/memory.h>
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));
}
external add_ints : first:int -> second:int -> int = "stub_add_ints"
let () =
let res = add_ints ~first:3 ~second:4 in
print_int res;
print_newline ()
$ ocamlopt -o foo.opt foo.ml foo_stub.c
$ ./foo.opt
7
--
2012/11/7, john.else@citrix.com <john.else@citrix.com>:
> Hi Gabriel,
>
> I agree it'd be better to use labelled arguments than not, for safety as
> you
> suggest. I was just wondering if there was a way to add labelled arguments
> directly to the external, rather than requiring a 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
>
next prev parent reply other threads:[~2012-11-07 16:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 15:54 john.else
2012-11-07 16:16 ` Gabriel Scherer
2012-11-07 16:26 ` john.else
2012-11-07 16:40 ` Florent Monnier [this message]
2012-11-07 17:02 ` John Else
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAE1DttA6xKFjR9jPgAQVyhnHEMReiWtgHoNerRGivine+AOuoA@mail.gmail.com \
--to=monnier.florent@gmail.com \
--cc=caml-list@inria.fr \
--cc=gabriel.scherer@gmail.com \
--cc=john.else@citrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox