calling SML from C

Anoq of the Sun anoq@HardcoreProcessing.com
Tue, 21 Aug 2001 17:29:23 +0200



Stephen Weeks wrote:
> As long as you mean inlining ML within ML code, yes.  MLton still has the whole
> program and will do all its usual stuff.  The dispatcher is the trick that I
> didn't think of back in January when you asked a similar question -- it allows
> us to export lots of functions via one main function.

Sounds great! :)

> GC will only happen during ML code, but if ML function f calls C, which then
> calls back into ML function g, a garbage collection can happen during g, and f
> must still work when C returns to it.  The idea we have is to run each call to
> ML from C in its own thread (not that there will be any sort of pre-emption).
> That way there can be lots of calls alive at once.  To get the GC right, we have
> to make sure that all of the threads are live somewhere, which shouldn't be too
> hard.  Of course, this scheme also also requires that the C side doesn't hold
> any pointers to ML data, which should follow from the types of arguments (int,
> real, ...) that can be passed back and forth.

OK - neat :)

> I'd like to revisit this question after we get the basic interface working.  Try
> us again in a couple of months after we get a release out with the basic
> C -> SML stuff working.

OK. I'm really glad to hear that you are actually going to implement
this C->SML
calling stuff! :)

Also - do you have any more bug-fixes to the current release? Because
I'm thinking
of trying to apply my Win32 port to the current release during the next
few days. I'm still not sure if the Mac OS port has green light though -
but I will also know that after the next few days :)


Cheers
-- 
http://www.HardcoreProcessing.com