Path: chuka.playstation.co.uk!scea!sumner From: sumner@austin.metrowerks.com (Joel Sumner) Newsgroups: scea.yaroze.programming.codewarrior,scee.yaroze.programming.codewarrior Subject: Re: Libraries again...(and malloc) Date: Mon, 09 Mar 1998 09:11:43 -0600 Organization: Metrowerks Lines: 53 Message-ID: References: <6dunc7$iap22@chuka.playstation.co.uk> NNTP-Posting-Host: mtwks151.metrowerks.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: Yet Another NewsWatcher 2.4.0 Xref: chuka.playstation.co.uk scea.yaroze.programming.codewarrior:293 scee.yaroze.programming.codewarrior:194 In article <6dunc7$iap22@chuka.playstation.co.uk>, "Steve Dunn" wrote: >Hi there, > I've got the libraries semi working. >Thanks to all that replied. >I have a library called 3DLib.lib. A >class in this library allocates memory >for order tables and packet buffers. >The problem is that malloc is allocating >all over the code area. >It goes like this... > Main PSX exe is located at >0x80140000 and is 0x4000 (16384) bytes >in length. Assuming the heap is >initialised correctly (anyone know how >to step into this in psstart.c?) Hi there, The call to "init_heap" is init_heap(base address, length_in_bytes) Make sure that a) You are calling init_heap (please read the note in _psstart.c... It is NOT called by default in a c program) b) When you call init_heap, the first arguement (in the a0 register) is the proper base address of your program. >Why is malloc misbehaving ? It may be the heap init. >What is the relevance of the 'code >address' for libraries ? There shouldn't be any. >How do you step into the 'init heap' >code supplied via the 'stationary' ? init_heap is provided by the Sony runtime libraries (in libps.h). Thus, you can't step into it. >Why can't the 'code model' be changed to >'position independent code' for libs? The compiler in the Net Yaroze doesn't support position independent code. -- PlayStation Development Tools Dude Metrowerks