<font face="verdana,sans-serif">Hi,</font><div><font face="verdana,sans-serif"><br></font></div><div><font face="verdana,sans-serif">I have been wondering for a while now if there's a good way to make ML code and Java code work together.</font></div>
<div><font face="verdana,sans-serif">What I would love to do is write a program in ML and wrap it with a GUI written in Java/Scala.</font></div><div><font face="verdana,sans-serif"><br></font></div><div><font face="verdana,sans-serif">What I have found so far is that it's possible to make Java work with C (JNI/JNA) and C work with ML (with MLton's Foreign Function Interface).</font></div>
<div><font face="verdana,sans-serif">Combining this, I would hope to get Java working with ML (via an interface written in C).</font></div><div><font face="verdana,sans-serif">However, it seems that JNI/JNA only works with dynamic libraries, that is dlls in Windows.</font></div>
<div><font class="Apple-style-span" face="verdana, sans-serif">The problem is that i can't get MLton to compile my ML/C program to a dll. </font><span class="Apple-style-span" style="font-family: verdana, sans-serif; ">Compiling the program to an executable works just fine.</span></div>
<div><font class="Apple-style-span" face="verdana, sans-serif">Is it just not possible to compile ML programs to dlls with MLton or am I doing something wrong?</font></div><div><span class="Apple-style-span" style="font-family: verdana, sans-serif; ">Or is there possibly a better way to make ML code and Java code work together?</span></div>
<div><span class="Apple-style-span" style="font-family: verdana, sans-serif; "><br></span></div><div><font class="Apple-style-span" face="verdana, sans-serif">I know it's possible to compile the ML programm to a standalone executable and simply call that executable from within Java.</font></div>
<div><font class="Apple-style-span" face="verdana, sans-serif">The problem is that this would limit data transfer beetween the programs to strings which might require lots of encoding and decoding and doesn't seem like a good solution.</font></div>
<div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><font class="Apple-style-span" face="verdana, sans-serif">Regards</font></div><div><font class="Apple-style-span" face="verdana, sans-serif">Steffen</font></div>