Click here to Skip to main content
16,006,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy7-Jan-08 6:51
professionalbgrupczy7-Jan-08 6:51 
GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen7-Jan-08 7:08
Maxwell Chen7-Jan-08 7:08 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy7-Jan-08 8:31
professionalbgrupczy7-Jan-08 8:31 
GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen7-Jan-08 15:06
Maxwell Chen7-Jan-08 15:06 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 4:44
professionalbgrupczy8-Jan-08 4:44 
GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen8-Jan-08 5:31
Maxwell Chen8-Jan-08 5:31 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy7-Jan-08 6:32
professionalbgrupczy7-Jan-08 6:32 
GeneralRe: Packing sections down to byte alignment? Pin
cmk7-Jan-08 17:50
cmk7-Jan-08 17:50 
I figured it would be a stretch to expect padding to account for the increase from 69 to 344 bytes.

Without looking at the code as a whole i don't expect you will be able to get much more help here.

Aside from that, the /SECTION and /ALIGN options, as mentioned elsewhere, aren't of any use as the alignment refers to the section as a whole, not the alignment/packing within.

Again, i don't believe there is a way to specify the alignment/packing within a section.

I tested the following sample:
#pragma pack(push, 1)
typedef struct {
	char    a[73];
	double  b;
	char    c[73];
} sa;
#pragma pack(pop)
typedef struct {
	char  b[100];
} sb;
 
#pragma bss_seg(push, "MY$AA")
sa  a;
#pragma bss_seg(pop)
 
#pragma bss_seg(push, "MY$AB")
sb  b;
#pragma bss_seg(pop)

I compiled for both x86 and x64.
- Both resulted in 8 byte alignment within the section (not 4).
- Both honoured the #pragma pack() statements.
Without the #pragma pack(), they packed using normal packing rules (e.g. double a.b aligned on 8 byte addr, if changed to long a.b, aligned on 4 byte addr).
- The results for the above, with packing:
&a.a = 0x...00
&a.b = 0x...49  73
&a.c = 0x...51  81 = 73 + 8
&b   = 0x...a0  160 = 154 (81+73) round up to next 8


So, from the above it seems you should have &b = 0x...48 for you code.
The fact that you don't would cause me to look elsewhere.
- Are you sure ee_block_bl_type is 69 bytes.
- Are any of its members other structures that may not be packed.
- Do any of its members have macro defined types/sizes.
- What are the results from dummpbin for the app as a whole and the "MY" section. In particular the raw dump of "MY" section.

...cmk

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack

GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen7-Jan-08 19:24
Maxwell Chen7-Jan-08 19:24 
GeneralRe: Packing sections down to byte alignment? Pin
cmk8-Jan-08 3:26
cmk8-Jan-08 3:26 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 4:58
professionalbgrupczy8-Jan-08 4:58 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 7:30
professionalbgrupczy8-Jan-08 7:30 
GeneralRe: Packing sections down to byte alignment? Pin
cmk8-Jan-08 10:55
cmk8-Jan-08 10:55 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 11:10
professionalbgrupczy8-Jan-08 11:10 
GeneralRe: Packing sections down to byte alignment? Pin
cmk8-Jan-08 11:17
cmk8-Jan-08 11:17 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy9-Jan-08 6:19
professionalbgrupczy9-Jan-08 6:19 
GeneralConvert JIS to ASCII... Pin
Chris Losinger6-Jan-08 5:53
professionalChris Losinger6-Jan-08 5:53 
GeneralRe: Convert JIS to ASCII... Pin
Nemanja Trifunovic6-Jan-08 6:07
Nemanja Trifunovic6-Jan-08 6:07 
GeneralRe: Convert JIS to ASCII... Pin
Chris Losinger6-Jan-08 6:16
professionalChris Losinger6-Jan-08 6:16 
GeneralRe: Convert JIS to ASCII... Pin
Nemanja Trifunovic6-Jan-08 6:28
Nemanja Trifunovic6-Jan-08 6:28 
GeneralRe: Convert JIS to ASCII... Pin
Chris Losinger6-Jan-08 6:41
professionalChris Losinger6-Jan-08 6:41 
GeneralRe: Convert JIS to ASCII... Pin
Michael Dunn6-Jan-08 7:22
sitebuilderMichael Dunn6-Jan-08 7:22 
GeneralRe: Convert JIS to ASCII... Pin
Luc Pattyn6-Jan-08 7:37
sitebuilderLuc Pattyn6-Jan-08 7:37 
GeneralStrings from a c++ Dll to VB 6.0 and vice versa ! Pin
CrocodileBuck6-Jan-08 1:59
CrocodileBuck6-Jan-08 1:59 
QuestionRe: Strings from a c++ Dll to VB 6.0 and vice versa ! Pin
CPallini6-Jan-08 2:59
mveCPallini6-Jan-08 2:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.