Next Previous Up Top Contents Index

2 Building Applications

2.5 Delivering applications with MLWorks

MLWorks allows you to produce executables from ML applications. This process is known as delivery.

Applications can be delivered using the function MLWorks.Deliver.deliver. This function takes two arguments:

To be specific, suppose you have defined the following function. It may have been defined in a file that was compiled and loaded, or in a file that was called with use, or by typing directly in the listener.

fun hello () = print "Hello, world.\n";

The print function is available at top-level in MLWorks, so you do not need to read any library code into MLWorks, nor require any libraries, to make this example work. For a delivery example that does use other libraries, see Section 3.5 on page 49, which delivers a simple program that uses the Standard ML Basis library for I/O.

By invoking MLWorks.Deliver.deliver from a listener, you can now deliver the function hello as an application:

MLWorks> MLWorks.Deliver.deliver ("hello.img", hello);

The executable file hello, considering what it does, may seem quite large. However, this is because it must contain a copy of the MLWorks runtime. This is a constant overhead (somewhat under 300 KB), so is less significant for larger programs..


MLWorks User Guide version 2.0 for UNIX/Linux - 31 Jul 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker