converting structs: DJGPP -> VC++
I''m writing a level-editor in DJGPP for my game in VC++ and have stumbled upon the next problem:
The 2 compilers doesn''t store the structures the same way.
Is there a way to convert the structures to the MSVC++ 6.0 format?
Your probably running into problems with structure alignment. Try using #pragma pack(n) where n is either 1, 2, 4, 8 or 16 before your data structure. Probably one of those will get the alignment right. I don''t know the default DJGPP alignment, but I''d guess 4. MSVC++ uses a default of 8.
Hmmm, still doesn''t work. Here is the code:
I''ve tried pragma pack 1,2,4,8 and 16. None of them equals to VC++.
#pragma pack(8)typedef struct{ unsigned short x __attribute__((packed)); unsigned short y __attribute__((packed)); unsigned short property1 __attribute__((packed)); unsigned short property2 __attribute__((packed)); unsigned short property3 __attribute__((packed)); unsigned short property4 __attribute__((packed));}SPECIAL;typedef struct{ SPECIAL special[32] __attribute__((packed)); char name[41] __attribute__((packed)); bool forwardevent[10] __attribute__((packed)); unsigned short forwardlayer __attribute__((packed)); unsigned short tileset[256] __attribute__((packed)); unsigned char changetotile[256] __attribute__((packed)); unsigned char tiletype[256] __attribute__((packed)); unsigned char layerid __attribute__((packed));}LAYER;#pragma pack(4)
I''ve tried pragma pack 1,2,4,8 and 16. None of them equals to VC++.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement