Hello,
I've got a problem accessing global constant data.
Situation:
header.h:
extern const int global_int;
extern const int *pt;
extern.c:
#include "header.h"
const int global_int = 23;
const int * pt = &global_int;
main.c:
#include "header.h"
...
if ( global_int == 23)
...
if (*pt == 23)
...
I'm using prc-tools 2.3 and pose.
The first comparision running in pose gives me the message:
app just read from memory location 0x00002706, which is an unlocked chunk of
memory.
The second comparision (the one with th pointer) works as expected.
I've found similar problems on the list. I understood that the const data
is stored in the code-section,
and therefore only intra-segment references are allowed.
The solutions was either using the pointer-variant, or disabling the
"PC-relative const data"-switch in Codewarrior to force the const data
beeing stored
in data segment.
I could not find a similar option for gcc.
Did I just not find it, or is there no posibility to get the code working?
--
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/