[MLton-user] Calling into SML from C
Vesa Karvonen
vesa.a.j.k at gmail.com
Thu Apr 12 06:18:27 PDT 2007
On 4/12/07, Zach Anderson <zra at cs.berkeley.edu> wrote:
> Is there an easy way to call into SML code from a program with a C
> main()? OCaml has a call in its runtime library to get the runtime up
> and going from inside a C program. Maybe there's something like that for
> MLton, and I just haven't found it, yet?
Not at the moment AFAIK. However, it is easy to make an application
with MLton that calls C code (library) which then calls SML code. For
example, you can have an application with an event loop written in C
that calls SML callbacks. The MLton FFI supports calling from C to SML
(http://mlton.org/CallingFromCToSML).
> What I'd like is something like is described in 18.8 of
> http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html.
>
> In other words, I'd like to get a library from MLton that I can link
> into my C program. I will happily call whatever initialization routines,
> and link in whatever other libraries I need to, but I don't know what
> those might be, or even if this is possible.
I believe Jens Axel Søgaard did some work on making it possible to
build shared libraries with MLton. You can follow discussions from
http://mlton.org/pipermail/mlton/2005-September/028042.html .
-Vesa Karvonen
More information about the MLton-user
mailing list