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
If I add this
wchar_t* foo = new wchar_t[1];
delete []foo;
(to a completely different file, remember), now the "bad" code succeeds and looks like this
wchar_t* newBufferW = new wchar_t[newLength+1];
0008507A: 2003 move.l d3,d0
0008507C: 5280 addq.l #1,d0
0008507E: E388 lsl.l #1,d0
00085080: 2F00 move.l d0,-(a7)
00085082: 487A000E pea awstringstream::ReallocateBuffer(unsigned long,awstringstream::whichbuffer_t)+0xb8 (0x85092)
00085086: 487A0004 pea awstringstream::ReallocateBuffer(unsigned long,awstringstream::whichbuffer_t)+0xb8 (0x8508c)
What the heck is going on here?
I mean, obviously it's linking in different code, but a. why and b. how can I make sure it links in the correct code every time.
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
