On 02/04/2013 13:25, René Neumann wrote:
Am 02.04.2013 14:02, schrieb David Matthews:
This would definitly be a great help for people new to Poly/ML. When I
had to produce a standalone executable from an ML-file it took me quite
some time before figuring out how it works.

Actually it's probably not much more than
    polyml --use myprogram.ML --use export.ML
Where export.ML is
    PolyML.export("polyml.o", main);
    OS.Process.exit OS.Process.success: unit;

Make the name of the resulting obj file a parameter and it's fine, I
think. Could look like (shell script):

polyml --use myprogram.ML <<EOF
PolyML.export("${output}", main);
EOF

Yes, of course. Having the object file name as a parameter, perhaps defaulting to the name of the source file with ".o" on the end, was my "much more than".

Perhaps one can also pour in the gcc-compile phase already, so it's one
step from ML-file to executable.

I don't know how that works so perhaps that's for later.

So, in summary, it should look like:
-c option: Compile a source file which must contain a function main of type unit -> unit (or string list => unit or string list -> int ???) and export the object file.

-o option: Used with -c to override the default object file name.

-i option: Force interactive mode. The default is interactive only if stdin is a terminal. This controls whether to print a prompt.

--skip-first-line option: Skip the first line of the input stream. Used with scripts with #! at the start.

Does that seem reasonable? I don't think there's much there that is very complicated. Should some of these imply the -q option?

David
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to