[squeak-dev] Appending arbitrary data to end of image..?
David T. Lewis
lewis at mail.msen.com
Wed Jan 19 03:48:53 UTC 2022
On Tue, Jan 18, 2022 at 11:34:21AM -0800, Tim Johnson wrote:
> Hi all,
> I am recalling that there was, at one time, a facility for appending
> arbitrary data to the end of the image file, such that it could be
> accessed from within the image once the image was running...?
> Am I imagining this?
> Perhaps I am conflating Ruby's DATA / __END__ facility and UNIX heredocs,
> and just imagining that this existed (even experimentally so) in Squeak.
> Tim J
I do not remember seeing such a thing, although there is a somewhat
similar-sounding mechanism for saving the image after skipping
the first 512 bytes of the image file. This is for supporting
shebang conventions, in which the image file looks like a shell
script to unix, but actually contains a Squeak image located
after the first 512 bytes of the file.
That said, there is no reason that you cannot append whatever
you want to the end of a Squeak image file, and then read that
data from the image. The VM will never know the difference.
However, as soon as you save the image, any data that you had
appended to the file will be lost so you would need to account
I did not check for sure, but I think that the image file header
contains enough information to determine the end of the meaningful
image data in an image file, and you could use that to figure
out where to start looking for any additional data that you
may have appended to the image file. See class ImageFileHeader
in the ImageFormat package that you can load from repository
More information about the Squeak-dev