The executables are built using heap2exec, a third-party utility designed to get round the problem that the NJML people decided to release a compiler that couldn't build executables, but only heap images which, whilst being just as big and no more portable, would only run in the presence of an ML runtime environment.
In a sane world you should just be able to make sure that the executable is
in your PATH and run it. However, as the world of SML-NJ 110 executables
isn't all that sane at the moment, you also have to do a bit more. The
symptom of not following these instructions is that you can run your
executable from the directory where it lives, but that if you put that
directory in your path and try to run the executable from somewhere else,
you get an error like
Fatal error -- unable to open heap image
From the heap2exec page:
Relative paths are somewhat problematic with heap2exec since the resulting executable uses its own name (argv) as the name of the image to load. If you want to place your executable in /usr/bin/ and invoke it as myprog, for example, name it myprog.heap2exec and place it in /usr/bin/. Then create a shell script /usr/bin/myprog with the content:#! /bin/ksh /usr/bin/myprog.heap2exec $*Now if /usr/bin/ is in your path (and you remembered to 'chmod +x myprog'), you should be able to invoke the executable from anywhere.
(Note: A new version of the runtime that will be able to generate stand-alone executables directly is planned for the next release.)