Shebang the image (was: [Vm-dev] (fwd) Re: 6502)
David T. Lewis
lewis at mail.msen.com
Thu Apr 23 04:00:46 UTC 2009
On Wed, Apr 22, 2009 at 06:24:12PM -0700, Eliot Miranda wrote:
> I'd also like to see the image read/write code respect the VM header size to
> allow for future expansion. I also like the ability to make the image
> executable on unices by leaving, say, 64 bytes, at the start of the file to
> fill with something like
> #!/bin/squeak $0 $@
> VisualWorks only allowed something like 32 bytes and that's a little tight.
This already works, and has been available for many years on Squeak. I have
a dim recollection that Lex Spoon may have been responsible for adding this.
In any case if you prepend a 512 byte gob of anything to the beginning
of any image file (added prior to the actual image header), then the image
will still load (the gob of bytes is skipped). If that gob of bytes happens
to start with the string "#!/usr/bin/squeak" and if you set the image file as
executable, then you can just execute the image directly, the /usr/bin/squeak
program will be invoked, and it will load the image file and start Squeak.
More information about the Vm-dev