[comp.sys.atari.st.tech] embedding a data file in an executable

mroberts@oracle.uucp (08/15/90)

I'd like to embed a data file in an executable (.PRG) file.  The idea is that,
when the program starts running, it can find its name with the appropriate OS
call (shel_read, I believe), open the executable as a binary file, seek past
the load image portion, and then start reading data.

I've tried doing this the simple-minded way:  figuring out how big the
executable is, then hardcoding that size into the fseek().  This is just fine,
until I actually append data to the end of the .PRG file.  When I do, the
program will not even load correctly, but bombs out with 3 or 4 bombs.

Does anyone have any ideas about how to do this?  I have the impression that
GEM is continuing to read the data that I append to the executable as though
it were more relocation table data.  After reading the Mark Williams C
documentation and nout.h and gemout.h, and dumping the executable itself,
I still don't have a very good idea about how the loader actually works.

Thanks,
Mike Roberts
mroberts@oracle.com