next up previous contents
Next: 14.1.1 Bootstrapping: How ml-build Up: 14. Auxiliary scripts Previous: 14. Auxiliary scripts   Contents


14.1 Building stand-alone programs

The programmer should normally have no need to invoke CM.mk_standalone (see Section 4.1.10) directly. Instead, SML/NJ provides a command ml-build which does all the work. To be able to use ml-build, one must implement a library exporting a structure that has some function suitable to be an argument to SMLofNJ.exportFn. Suppose the library is called myproglib.cm, the structure is called MyProg, and the function is called MyProg.main. If one wishes to produce a heap image file myprog one simply has to invoke the following command:


  ml-build myproglib.cm MyProg.main myprog

The heap image is written only when needed: if a heap image exists and is newer than all ML sources involved, provided that none of the ML sources have to be recompiled, ml-build will just issue a message indicating that everything is up-to-date.

As in the case of sml, it is possible to define or undefine preprocessor symbols using -D or -U options (see Section 13.3). These options must be specified before the three regular arguments. Thus, the full command line syntax is:


  ml-build [DU-options] myproglib.cm MyProg.main myprog



Subsections
next up previous contents
Next: 14.1.1 Bootstrapping: How ml-build Up: 14. Auxiliary scripts Previous: 14. Auxiliary scripts   Contents
Matthias Blume
2001-07-19