From: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk)
To: caml-list@inria.fr
Subject: Re: [Caml-list] create a closure in external C function?
Date: 7 Mar 2001 00:22:27 GMT [thread overview]
Message-ID: <slrn9aavq2.29o.qrczak@qrnik.zagroda> (raw)
In-Reply-To: <4.3.2.7.2.20010306140915.03782b00@shell16.ba.best.com>
Tue, 06 Mar 2001 14:56:51 -0800, Chris Hecker <checker@d6.com> pisze:
> On the C side, we'll use the ffcall trampoline/vacall interface
> to pass qsort the pointer to a function that calls back the caml
> function with the right parms.
I've just seen ffcall. callback is approximately what I wanted.
trampoline+vacall is evil. It uses a global variable; this is not
thread safe.
callback seems to be better, but still more kludgy than I expected.
I'm not sure if it's the right choice for OCaml; it should not be
*that* ugly. Especially if you statically know types of arguments,
which is the case I am talking about. Unfortunately it's very
processor-dependent.
I would like to have this functionality in OCaml's foreign function
interface, without forcing to rely on an inconvenient third-party
package.
I'm not sure how it should look like, because OCaml has a different
approach to FFI than Haskell: the OCaml<->C glue is in C, where for
Haskell<->C the glue is in Haskell. So Haskell defines a mapping
from Haskell function types involving primitive types to C types,
and a special kind of declaration which defines converters from
Haskell functions to C function pointers of particular types. The
OCaml's approach would need to call the conversion from the C level,
in which case the compiler has no chance of generating stubs tailored
for a particular type but must offer a generic C interface with its
own way to describe C types.
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-03-07 0:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-06 9:29 Chris Hecker
2001-03-06 10:50 ` Fabrice Le Fessant
2001-03-06 17:01 ` Xavier Leroy
2001-03-06 18:19 ` Chris Hecker
2001-03-07 3:23 ` Fergus Henderson
2001-03-06 18:58 ` Marcin 'Qrczak' Kowalczyk
2001-03-06 19:13 ` Chris Hecker
2001-03-06 21:16 ` Marcin 'Qrczak' Kowalczyk
2001-03-06 22:56 ` Chris Hecker
2001-03-07 0:22 ` Marcin 'Qrczak' Kowalczyk [this message]
2001-03-07 0:44 ` Chris Hecker
2001-03-07 8:49 ` Marcin 'Qrczak' Kowalczyk
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=slrn9aavq2.29o.qrczak@qrnik.zagroda \
--to=qrczak@knm.org.pl \
--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).