| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: dates |
Tue 2002-11-19 15:49, Stas Degteff (2:5080/102) wrote to andrew clarke:
ac>> I found the bug!
ac>> So, I think Msged and my XMSGAPI code were being compiled using
ac>> differing structure alignments. But I seem to recall there were
ac>> explicit #pragma pack statements in the original SMAPI code.
> This is not need: XMSG used as message buffer and only elements of this
> structure read/write.
No, there's more to it than that!
XMSG is also used as a parameter to MsgWriteMsg(). If an application
program thinks sizeof(XMSG) == 248, and the precompiled SMAPI library
thinks sizeof(XMSG) == 238, you will have CORRUPT DATA (as I demonstrated).
Also, in msgapi.h there is:
#define XMSG_FROM_SIZE 36
#define XMSG_TO_SIZE 36
#define XMSG_SUBJ_SIZE 72
#define XMSG_SIZE (94 + XMSG_FROM_SIZE + XMSG_TO_SIZE + XMSG_SUBJ_SIZE)
So, the library basically requires that sizeof(XMSG) MUST BE 36 + 36 + 72 +
94 == 138. But ever since the #pragmas were removed there's been nothing
in the source code to tell the C compiler not to pad the structure!
Regards
Andrew
-- mail{at}ozzmosis.com
--- Msged/NT 6.1.1
* Origin: Blizzard of Ozz, Mt Eliza, Victoria, Australia (3:633/267)SEEN-BY: 633/270 @PATH: 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.