Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » default packing Collapse All
Subject Author Date
Bill Comstock Jan 23, 2013 - 9:16 AM

I am converting an application to run on WIN 7 64 bit OS, as a 32 bit app (using ProfUIS), and using VS2010. I had to modify a number of my app’s include files to specify explicit packing that I require. I now get many C4121 warnings on a number of ProfUIS include files --> alignment of a member was sensitive to packing. e.g.  below, the warning is on the DWORD following the bool.

 __EXT_UX_HTHEME m_hUxTheme;

 HINSTANCE m_hUxThemeDll;

 bool m_bNeedToFreeDll:1;


 DWORD m_dwComCtlVersion;

What default packing is ProfUIS expecting for its include files?  What can I do so the compiler does not give these warning (other than to suppress them). Thanks

Art Wilkes Jun 11, 2013 - 10:28 AM

The problem of packing has to do with base size of the memory word. I would assume that Win64 would use a 8 byte word. Whereas the Win32 would be 4.
I would think a
#pragma pack(8)
Would solve your problem.
Let me know
This is Microsoft’s explanation.
Error Message
’symbol’ : alignment of a member was sensitive to packing
A structure member is aligned on a memory offset whose value is not a multiple of the member’s size. For example, the following code snippet will produce this warning:
// C4121.cpp
// compile with: /W4 /c
#pragma pack(2) // C4121
struct s
char a;
int b;
You could make one of the following changes to prevent this warning:
•    Change pack(2) to pack(4).
•    Reverse the order of the structure members such that the int precedes the char.
When data is not aligned on boundaries that are multiples of the data’s size performance can degrade and if you port your code to a RISC machine it will not compile.
You can specify the structure alignment with #pragma pack or /Zp. Note that the compiler does not generate this warning when /Zp1 is specified.