www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/16/04:16:40

From: wanpsm98 AT octarine DOT cc DOT adfa DOT oz DOT au (WANKADIA PAUL SAPAL MICHAEL)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Executables with added data.
Date: 16 May 98 05:58:39 GMT
Lines: 16
Message-ID: <wanpsm98.895298319@octarine>
References: <en871.8012$z15 DOT 4555537 AT news21 DOT bellglobal DOT com>
NNTP-Posting-Host: 131.236.253.20
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

"Paul Derbyshire" <pderbysh AT usa DOT net> writes:

>Using DJGPP (but not Allegro) is there a simple way to add an arbitrary chunk
>of binary data after the DJGPP exe, and have it available for read/write as if
>it were a file? Is there some sort of pointer in the exe to the end to allow a
>simple seek to the start of the added data (if any) and read/write data there?

Check the default ld script for the symbol that marks the end of the COFF 
image:  it's 'end' or '_end' (or both), IIRC.  You'd probably just 
declare it as an 'extern int' (the datatype doesn't matter) and then take 
the address of it with '&'; however, keep in mind that the compiler will 
automatically prefix the declared variable name with an underscore (as, 
of course, you already know).

I had to use this for PUNIX, in order to calculate some memory-related 
values; however, I think I did it with ASM (or inline ASM).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019