Shared Libraries in Poly / ML

Is it possible to create a shared library using Poly / ML? I want to be able to create the C API for the Poly / ML library and call / load it from different programming languages ​​(e.g. Python). Has anyone tried to do this? I know this can be done in OCaml:

+4
source share
1 answer

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.

+3
source

Source: https://habr.com/ru/post/1490791/


All Articles