caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] C stubs with many args.
Date: Sun, 29 Nov 2009 17:28:36 +0100	[thread overview]
Message-ID: <4B12A134.3090703@citycable.ch> (raw)
In-Reply-To: <4B1293BF.1000300@citycable.ch>

Guillaume Yziquel a écrit :
> Hi.
> 
> I've been recently reworking Maxence Guesdon's OCaml-R binding in order 
> to provide a tighter integration with, and I'm currently trying to 
> reverse-engineer the way closures are handled in R. So I've written up 
> this small C stub code for a function with 6 parameters:

OK. Figured it out. Stupid me:

> void Rf_begincontext (RCNTXT * cptr, int flags, SEXP syscall, SEXP env, SEXP sysp, SEXP promargs, SEXP callfun);
> CAMLprim value r_reveng_begin_context_native (value flags, value syscall, value env, value sysp, value promargs, value callfun) {
>   CAMLparam5(flags, syscall, env, sysp, promargs);
>   CAMLxparam1(callfun);
>   CAMLlocal1(result);
>   result = caml_alloc(1, Abstract_tag);
>   Rf_begincontext ( (context) Field(result, 0), Int_val(flags), Sexp_val(syscall), Sexp_val(env),
>                     Sexp_val(sysp), Sexp_val(promargs), Sexp_val(callfun));
>   CAMLreturn(result);
> }
> CAMLprim value r_reveng_begin_context_bytecode (value * argv, int argn) {
>   return r_reveng_begin_context_native(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
> }

All the best,

-- 
      Guillaume Yziquel
http://yziquel.homelinux.org/


  reply	other threads:[~2009-11-29 16:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-29 15:31 Guillaume Yziquel
2009-11-29 16:28 ` Guillaume Yziquel [this message]
2009-11-29 18:31 ` [Caml-list] " Richard Jones

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=4B12A134.3090703@citycable.ch \
    --to=guillaume.yziquel@citycable.ch \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).