Objective Grid : PART II Programmer’s Guide : Chapter 15 Advanced Concepts : Struct Member Alignment
Struct Member Alignment
The Objective Grid libraries have been built with struct member alignment set to 8 bytes. Please make sure your application also uses this calling convention.
To set struct member alignment to 8 bytes in Microsoft Visual Studio:
1. Select Solution Explorer from the View menu.
2. Right click on the root node and select Properties.
3. Once the dialog appears, click the C/C++ tab and select Code Generation from the Category combo box.
The struct member alignment combo box will appear.
If you require another struct member alignment, you will have to rebuild the Objective Grid libraries with the same calling convention. Otherwise you will get unresolved externals when linking to Objective Grid.
To rebuild the Objective Grid libraries with a 1-byte alignment:
1. In gxall.h change pshpack8 to pshpack1—as shown in the code below.
 
#ifndef _GXALL_H_
#define _GXALL_H_
 
// OG uses 8 byte packing for structures
#if _MFC_VER >= 0x0300
// pshpackX.h saves the current #pragma pack value
#include /* */ "pshpack1.h"
#else
#pragma pack(1)
#endif
 
#if _MFC_VER >= 0x0300
#include <afxcmn.h> // MFC support for Windows 95 Common Controls
#include <afxole.h> // MFC support for OLE
#endif
2. Compile the Objective Grid library with the /Zp1 option.