Wireshark mailing list archives

Re: Structure sizes change between Linux and Windowshelp


From: "news.gmane.com" <AndreasSander1 () gmx net>
Date: Fri, 29 Jul 2011 11:27:05 +0200

Even if you shouldn't use structs as you can read in README.developer MSVC 
provides the tools:

#ifndef GNUC
#pragma pack(push)
#pragma pack(1)
#endif

struct foo {
  char x;
  int y;
}
#ifdef GNUC
__attribute__((packed))
#endif
;

struct bar {
  char a;
  long b;
}
#ifdef GNUC
__attribute__((packed))
#endif
;

#ifndef GNUC
#pragma pack(pop)
#endif

It looks as it is: ugly.
Please note that the #ifdef GNU probably needs to be changed, I don't know 
the correct symbol to check for.



"Alex Lindberg" <alindber () yahoo com> wrote in 
message 
news:1311888444.59800.YahooMailClassic () web162017 mail bf1 yahoo com...
I am creating a dissector that overlays a complicated struct (bit fields, 
unions, etc) on the the tvb.  My Linux version works as designed, however 
when I move it to Windows (win32) the size of the struct changes and thus, 
won't overlay the tvb properly.

I am not an expert with Windows, but is there a compiler flag that will 
cause CC and/or LINK to work the same as GCC?

Thanks for your help.

Alex Lindberg






___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: