[MLton] Exporting closures to C code
Henry Cejtin
henry.cejtin@sbcglobal.net
Sun, 25 Sep 2005 21:34:34 -0500
You want to do much more than that because of the fact that the data in the
environment closed over has to be GC'd.
In general, all of the approaches I have seen to doing this (in mGTk among
others) cause the extra C arg to be an int which is then used to look up the
function (on the ML side) in a table and call it. I.e., the code part of the
call back is always to the same function and only the `environment' part tells
you which MLton closure you are going to call.