caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dbely@mail.ru>
To: caml-list@inria.fr
Subject: Re: [Caml-list] CamlIDL question
Date: Sun, 13 Oct 2002 21:10:59 +0400	[thread overview]
Message-ID: <wuome02k.fsf@mail.ru> (raw)
In-Reply-To: <20021013104825.H13771@pauillac.inria.fr> (Xavier Leroy's message of "Sun, 13 Oct 2002 10:48:25 +0200")

Xavier Leroy <xavier.leroy@inria.fr> writes:

>> Is the below trick is possible in CamlIDL?
>> I want to wrap C library that uses structs for storing
>> pointers to functions
>
> No, CamlIDL doesn't support C function pointers.  The reason is that
> mapping C functions pointers to Caml functions is easy, but mapping
> Caml function closures to C functions is nearly impossible (there is
> nowhere to store and pass the environment part of the closure).

It's possible using the "trampoline" technique, when the necessary small
stub functions are generated on the fly in the data (or stack)
segment. This is how gcc's nested functions work. There is "ffcall" library
that implements trampolines for (probably) all hardware platforms where
OCaml may run. Am I using it with OcamlIDL to do just what Youry asked
for. Unfortinately ffcall's author website has been disappeared, but it
should not be a problem to find "ffcall-1.8c.tar.gz" somethere in the
Internet.

- Dmitry Bely


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-10-13 17:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-07 14:02 Yurii A. Rashkovskii
2002-10-13  8:48 ` Xavier Leroy
2002-10-13 17:10   ` Dmitry Bely [this message]
2002-10-13 23:12     ` Chris Hecker
2005-10-25 22:26 Christian Stork
2005-10-26  5:03 ` [Caml-list] " Igor Pechtchanski
2005-10-26 11:11   ` Christian Stork

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=wuome02k.fsf@mail.ru \
    --to=dbely@mail.ru \
    --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).