Assuming you are building the structures yourself, you might also try this:

typedef union ALIGNED_STRING
{
   uint32 aligner;
   char string[MAXLEN];
} ALIGNED_STRING;


Then declare all strings within your structures using ALIGNED_STRING:

struct MyHeaderSummary
{
   int16 foo;
   char bar;
   ALIGNED_STRING text;
};

Of course, you then access the contexts of .text as ".text.string. In *theory* (as in "I have not tried this myself") the presence of the uint32 in the union should force the compiler to align the union.

Of course, in theory you could also skip the typedef:

struct MyHeaderSummary
{
   int16 foo;
   char bar;
   union
   {
       uint32 dummy;
       char string[MAXLEN];
   };
};


Lastly, if you don't mind a GNUCC`ism in your code, you could use __attribute__

struct MyHeaderSummary
{
   int16 foo;
   char bar;
   char string[MAXLEN]  __attribute__ ((aligned (4)));
};

_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers

Reply via email to