You can do much of this with the current version. If you use CreateProcess to run Poly/ML as a process and provide standard input and standard output streams it will use those rather than create a GUI interface. This is the way MLShell works. You can even use Windows.execute to run a separate version of Poly/ML within Poly/ML itself.
val (inp, outp) = let open Windows val p = execute("C:\Program Files\Poly ML\PolyML.exe", ""C:\Program Files\Poly ML\PolyML.exe" "C:\Program Files\Poly ML\ML_dbase.pmd"") in (textInstreamOf p, textOutstreamOf p) end; fun writeOutput() = (print(TextIO.input inp); writeOutput()); Process.fork writeOutput; TextIO.output(outp, "1+2;\n"); TextIO.output(outp, "OS.Process.exit OS.Process.success;\n");
Note this will only work if you start running Poly/ML with a different database or if the database has been set to read-only. There is also a way to send an interrupt (control-C) to the process using DDE. If you want more information send me an email.
Running Poly/ML within the same address space is much more of a problem. As you point out the database is always mapped at the same address. This is to avoid having to relocate it whenever it is loaded. It's difficult to see how to get round this problem without big changes to the run-time system.
David.
On Friday, June 28, 2002, at 10:59 , Bart Jacobs wrote:
It would be great if it were possible to use Poly/ML from other programming languages. The problem with these scenarios is that Poly/ML would have to live together with other modules in the same process. This probably causes multithreading issues and address space issues.
As an approximation to the DLL approach I discussed above, I'm looking into writing some simple remote procedure call code to connect the Poly/ML process and the .NET process. That way, Poly/ML would be a kind of "server" accepting remote procedure calls through a socket. (See also my previous mail.)
Is it possible to run Poly/ML on Windows without the user interface? This would allow me to invisibly launch Poly/ML from the .NET program, with a database that contains an "onEntry" function that listens on a TCP port and accepts remote procedure calls.