[MLton] Exporting closures to C code

Florian Weimer fw@deneb.enyo.de
Sun, 25 Sep 2005 22:19:22 +0200


* Jens Axel Søgaard:

> Florian Weimer wrote:
>> Most C libraries which use callback functions provide some means to
>> pass a user-supplied pointer to the callback function.  This could be
>> used to invoke MLton functions from C code (passing the closure
>> explicitly), even if these functions are not exported.
>> How hard would that be to implement?
>
> Perhaps you could simply pass a pointer to Cfunc?
> Here Cfunc is described in:
>
> <http://mlton.org/pipermail/mlton/2005-September/028052.html>

It's not quite the same thing.  There can be only one active closure
per exported function.  It's better than nothing, sure, but not quite
the thing I'm looking for.