Structured Storage (struct alignment)

John Emmas
  • John Emmas
    John Emmas

    This might not be a problem for everyone but I thought I'd flag it up anyway....

    After a recent upgrade to v1.1, I noticed that I was being forced to compile with 8-byte structure alignment (Windows SDK, by the way). This seems to be a requrement of using the new Structured Storage library from SchemaSoft.

    For me, this was a bit of a drawback because of the fact that other pressures require me to compile with 1-byte alignment. However I've discovered that, with judicious use of #pragma pack(push, 8) and #pragma pack(pop) I can compile the Structured Storage stuff with 8-byte alignment whilst, at the same time, compiling the rest of my library code with whatever alignment I choose.

    Only four files need to be modified (assuming I haven't missed anything). These being.....


    They require the following two lines to be inserted at line 44, 60, 15 and 41 respectively....

    #pragma warning (disable : 4103 )
    #pragma pack(push, 8)

    Each of the 4 files will then require.... #pragma pack(pop)

    to be inserted at the bottom (literally, at the bottom except in the case of "OMMSStructuredStorage.h" where it needs to be just inside the final #endif).

    I'll keep monitoring this and post here again if it causes any problems. Howerver, everything seems to be working fine at the moment.

    • John Emmas
      John Emmas

      Just a quick update to say that I've been monitoring the situation for about 2 months and everything still seems to be working fine.

      At least one other developer has encountered the 8-byte alignment problem, so I'd like to recommend that the suggested mods should be considered for inclusion in the official code.