Path: chuka.playstation.co.uk!tjs From: tjs@cs.monash.edu.au (Toby Sargeant) Newsgroups: scea.yaroze.programming.gnu_compiler Subject: Re: InitHeap() values? Date: 14 Jul 1999 23:45:39 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 27 Message-ID: References: <1dtrbvv.gn5m1cra6ha8N@user-33qthqr.dialup.mindspring.com> NNTP-Posting-Host: longford.cs.monash.edu.au X-Newsreader: slrn (0.9.4.3 UNIX) On Wed, 14 Jul 1999 12:58:15 -0700, wayne a. lee wrote: >hi, > >i've been using codewarrior on the mac up till now, but i'd like my code >to compile under gcc on the pc as well. my program uses the heap (malloc >etc.), so in main() i call InitHeap(). with the metrowerks compiler, i >can use linker-defined variables to make my heap as big as available >memory (from the end of my code up to the location of the stack). are >there similar linker-defined values available in gcc? or will i have to >inspect the map file and hard-code in the heap addresses by hand? > >thanks! I wrote a long response, but lost it before i sent it. _end is a symbol that marks the highest memory address used statically by your code. 0x801ffff0-_end-stack_size is the size of your heap. choose stack_size appropriately. you can find out all the symbols that the linker defines by looking in the linker scripts (mipspsx.x, and co). you should learn more about the linker scripts, because they can give you cmplete control over the linking of your code, which can be really quite handy. toby.