X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Trace-PostClient-IP: 68.147.131.211 From: Brian Inglis Newsgroups: comp.os.msdos.djgpp Subject: Re: Sequence of Symbol Allocation Organization: Systematic Software Message-ID: References: X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 38 Date: Mon, 09 Aug 2004 03:12:18 GMT NNTP-Posting-Host: 24.71.223.147 X-Complaints-To: abuse AT shaw DOT ca X-Trace: pd7tw1no 1092021138 24.71.223.147 (Sun, 08 Aug 2004 21:12:18 MDT) NNTP-Posting-Date: Sun, 08 Aug 2004 21:12:18 MDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sun, 8 Aug 2004 22:53:04 +0200 in comp.os.msdos.djgpp, Werner Schönenberger wrote: >> If the application uses C code and normal C startup code, allocating >> those variables as if they were C extern in the BSS segment will cause >> them to be zeroed at program initialization. >> Alternatively, look at how GCC handles BSS zeroing, for an example of >> how to do it properly, by arranging symbols with the linker. >thank you for the information. Unfortunately almost all code is written >in assembler which also doesn't make it easy to understand and to find >all the traps. But nevertheless to check out GCC might help to find a >solution. If you define a file globals.c (below), provide a(n alias for the entry point) symbol in your program called _main (or main if in C code), compile it (with gcc option -fno-leading-underscore) and link it with gcc to your other code, you should find that the symbols are defined in order in memory and initialized to all bytes zero when your code is called, and the names should not be prefixed by the normal _. You might also have to change the current name of the entry point symbol in your program to _main if it conflicts with the C startup code: file crt0.S symbol start for gcc IIRC. globals.c: short A; short b; long c; short d; double e; short f; short Z; -- Thanks. Take care, Brian Inglis Calgary, Alberta, Canada Brian DOT Inglis AT CSi DOT com (Brian dot Inglis at SystematicSw dot ab dot ca) fake address use address above to reply