HI,

I'm having some difficulties getting my app
to run properly after converting from GCC++.
It is giving 2-4 byte alignment error, odd byte memory address.
The GCC++ code uses __attribute__ ((packed))

here is my structure

// GCC++ version for reference
typedef struct
{
        UInt16 idxRecord __attribute__ ((packed));
        UInt16 offset __attribute__ ((packed));
        UInt8 len __attribute__ ((packed));
} ListRecordType, *ListRecordPtr;

// converted CW9++

#pragma options align=packed
typedef struct
{
        UInt16 idxRecord;
        UInt16 offset;
        UInt8 len;
} ListRecordType, *ListRecordPtr;
#pragma options align=reset

in my code is do to access the structure

....
int index;

ListRecordPtr pRecord;

// get the point to the packed record
pRecord = GetRecordPtr(....);

// get the index from the packed record
index = pRecord->indRecord; <------ odd byte memory address error

after the crash the value shown in the debugger is correct but
access to the structure pointer gives error in the code.

questions:

1. is the above the correct way to convert packed records from
GCC++ to CW9?

2. How do I fix the odd byte memory fatal error

thanks


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

Reply via email to