I can't do a
new wchar_t[80]
in a no-globals launch code in one of my source files. The problem only occurs in release builds, not debug.
But if I do a wchar_t* foo = new wchar_t[1]; delete []foo; in my application start (which is in a different source file), then I can.
This is the code that fails
wchar_t* newBufferW = new wchar_t[newLength+1];
0008579A: 2003 move.l d3,d0
0008579C: 5280 addq.l #1,d0
0008579E: E388 lsl.l #1,d0
000857A0: 2F00 move.l d0,-(a7)
000857A2: 600A bra.s awstringstream::ReallocateBuffer(unsigned long,awstringstream::whichbuffer_t)+0xb8 (0x857ae); 0x000857ae
000857A4: 2000 move.l d0,d0
000857A6: 2000 move.l d0,d0
000857A8: 2000 move.l d0,d0
000857AA: 2000 move.l d0,d0
000857AC: 2000 move.l d0,d0
000857AE: 4EADFB62 jsr -1182(a5) *** FAILS here if no globals!!!
000857B2: 2848 movea.l a0,a4
This is indicating that the code that implements the array new operator is in a source file that's in a different segment. This might happen if you put the runtime library in a segment other than the first (a very bad idea). You may want to use inline definitions of these operators rather than use the ones from the runtime library.
See http://www.palmoswerks.com/2001/10/31 for some more details on how this all should work.
-- Ben Combee, senior DTS engineer, PalmSource, Inc. Read "Combee on Palm OS" at http://palmos.combee.net/
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
