Very interesting, thanks, that gives me a lot to digest. I had a quick go at getting a console build of the 5.7 release using VS2015. If I simply naively switch the subsystem from Windows to Console in the PolyML project, I get "main" unresolved. I can see that WinMain and main are alternatives in polystub.c, but switching to the other #ifdef branch here just gives me polymain unresolved instead.
I can see that there are separate polymain and PolyWinMain implementations in there, but before I go hacking around the various #ifdef branches to try to get polymain called, is there a config option for this that will handle it without altering the code? Chris On Tue, 2 May 2017, at 13:05, David Matthews wrote: > Hi Chris, > The Windows version of Poly/ML only puts up a GUI if it has to. When it > first starts it checks to see whether the standard input and output > streams are provided and uses those if it can. That means that it's > possible to run Poly/ML as a background process if some other > application is providing the interaction. That's how programs such as > Isabelle work. > > If it needs an input or output stream it normally does this by creating > a Windows-style GUI. It is possible to create a version of Poly/ML that > creates a console when it starts instead of the GUI. To do this you > need to create a Windows executable with the subsystem:console flag set > in the .EXE file. When Windows starts an executable with this flag it > creates a console for it unless it is already running under the command > console. > > There are really three ways to do this. One that's been mentioned is to > use Cygwin. This seems to create executables with the flag set but it > does other things as well and requires the Cygwin DLLs. The alternative > is to create a native Windows application. That can be done using > either Windows Visual Studio or Msys/Mingw. > > The Poly/ML source distribution includes "projects" and a "solution" for > Visual Studio and you can use the free "community" edition to build > Poly/ML. You will need to change the linker "subsystem" option from > "Windows" to "Console" but otherwise it's fairly straightforward. > > The other option is to build using Msys and Mingw. In that case you can > set the subsystem by using the "--disable-windows-gui" option to > "./configure". There have been a number of forks of both Msys and Mingw > and I would recommend the sequence that Chun Tian posted from Isabelle. > This is based on my experience with various combinations of the > distributions together with the experience of Makarius. > > Hope this answers your questions. > > David > > On 01/05/2017 19:32, Chris Cannam wrote: > > That's good to know, thanks. I'm guessing this has a runtime dependency > > on other Cygwin or WSL libraries and can't easily be distributed > > standalone? > > > > I'm primarily wondering what is the most minimal possible installation > > that I can ask a Windows user (who probably starts without either Cygwin > > or WSL installed) to make, in order to make use of a script that happens > > to involve running an SML program. For this purpose it doesn't actually > > have to be a REPL, though that would be nice to have generally. Just > > running a program and presenting the output would be enough. > > > > > > Chris > > > > On Mon, 1 May 2017, at 19:12, [email protected] wrote: > >> Building under Cygwin or with the official Linux subsystem gives you > >> this. > >> > >> Michael > >> > >> On 1/5/17, 19:49, "[email protected] on behalf of Chris Cannam" > >> <[email protected] on behalf of [email protected]> > >> wrote: > >> > >> Hello -- I'm wondering whether there is a Windows build of Poly/ML > >> available that can be used from a within command prompt or executed > >> from > >> a Powershell script, in the same sort of way as SML/NJ can be on > >> Windows, or as Poly/ML can on other platforms. > >> > >> As far as I can see the Windows distribution contains an executable > >> that > >> always opens its own window and provides its own interactive prompt, > >> which (although nice enough) is not quite what I want at the moment. > >> > >> Is there such a thing out there? > >> > >> Thanks, > >> > >> > >> Chris > >> _______________________________________________ > >> polyml mailing list > >> [email protected] > >> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml > >> > >> > > _______________________________________________ > > polyml mailing list > > [email protected] > > http://lists.inf.ed.ac.uk/mailman/listinfo/polyml > > _______________________________________________ polyml mailing list [email protected] http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
