From 5e55cc27b20bf8c00f0a85b94b615b13e528932c Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Sun, 19 Feb 2012 23:11:53 +0100 Subject: mingw: use gcc attributes for struct packing It automatically chooses between using the gcc construct or the visual-c++ construct at compile-time. --- common/vdcommon.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/vdcommon.h b/common/vdcommon.h index edcfa1e..c5268f4 100644 --- a/common/vdcommon.h +++ b/common/vdcommon.h @@ -45,12 +45,20 @@ enum { VD_AGENT_SESSION_LOGON, }; -typedef __declspec (align(1)) struct VDPipeMessage { +#if defined __GNUC__ +#define ALIGN_GCC __attribute__ ((packed)) +#define ALIGN_VC +#else +#define ALIGN_GCC +#define ALIGN_VC __declspec (align(1)) +#endif + +typedef struct ALIGN_VC VDPipeMessage { uint32_t type; uint32_t opaque; uint32_t size; uint8_t data[0]; -} VDPipeMessage; +} ALIGN_GCC VDPipeMessage; typedef struct VDPipeBuffer { OVERLAPPED overlap; -- cgit v1.2.3