Question

Is it possible to build a shared library using Poly/ML? I want to be able to create a C API for a Poly/ML library, and invoke/load it from different programming languages (e.g., Python). Did anybody try to do that? I know this can be done in OCaml:

Was it helpful?

Solution

Here is an answer provided by David Matthews, Poly/ML main developer (http://www.polyml.org/):

The simple answer is no, at least at the moment. I had a look at this and wondered if it was possible. The foreign-function interface allows for call-back functions so there is the mechanism to produce a C function that when called calls an ML function. The difficulty I could see was that in order to produce a shared library the closure for the C function has to be "unpicked" so that relocation information can be produced for addresses within the closure. I'd have to add something to libffi to do that. It doesn't look to be too hard for X86 but I haven't taken it any further. There may be other issues that I'm not aware of.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top