"GB" <[EMAIL PROTECTED]> wrote in message
news:76085@palm-dev-forum...
>
> I am attempting to declare a const array:
>
> const UInt8 F2000m[4] = { 3,   4,  1,  1 };
> // more declarations like this...
>
> and then include the address of it when
> initializing a structure later on.  The structure
> has a member:
>
> const UInt8 *pCharArray;   // Ptr to variable length array
>
> I get:
>
> Error   : illegal initialization
> HotSpot.c line 102                         { 2000, 4, F2000m } };
>
> How can I create a pre-defined table of addresses?

Are you using the "PC-relative const data" option in the compiler?  The
problem is that when this is on, you can't have structure that
themselves contain pointers, since the data is read-only, and the
runtime library won't be able to adjust the read-only data to have the
right pointer at runtime.

If you turn this off, you can do the constant tables, but they will be
in the data space, not the code space, and they won't be available.

You could declare your pCharArray member as "const UInt8
pCharArray[4]" -- then the data would be embedded into the table and the
whole thing could be put in constant storage.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to