Here is the answer from David Matthews, Poly / ML's lead developer ( http://www.polyml.org/ ):
The simple answer is no, at least for now. I looked at it and wondered if it was possible. The external function interface allows you to perform callback functions, so there is a mechanism for creating C, which, when called, calls the ML function. The difficulty I could see was that to create a shared library the closure was because the C function had to be "dissolved" so that relocation information could be created for the addresses in the closure. I have to add something for libffi for this. It does not look too complicated for X86, but I did not take it further. There may be other problems that I do not know.
source share