Explicitly specify alignment of 64-bit types.
diff --git a/include/axcore.idl b/include/axcore.idl
index ecac893..de5dbbb 100644
--- a/include/axcore.idl
+++ b/include/axcore.idl
@@ -48,7 +48,7 @@
cpp_quote("#define MAX_FILTER_NAME 128")
typedef LONGLONG REFERENCE_TIME;
-typedef double REFTIME;
+typedef DOUBLE REFTIME;
typedef DWORD_PTR HSEMAPHORE;
typedef DWORD_PTR HEVENT;
diff --git a/include/basetsd.h b/include/basetsd.h
index 615b371..274f41b 100644
--- a/include/basetsd.h
+++ b/include/basetsd.h
@@ -59,20 +59,31 @@
# endif
#endif /* !defined(_MSC_VER) */
+/* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */
+#ifndef DECLSPEC_ALIGN
+# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
+# define DECLSPEC_ALIGN(x) __declspec(align(x))
+# elif defined(__GNUC__)
+# define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
+# else
+# define DECLSPEC_ALIGN(x)
+# endif
+#endif
+
typedef signed char INT8, *PINT8;
typedef signed short INT16, *PINT16;
typedef signed int INT32, *PINT32;
-typedef signed __int64 INT64, *PINT64;
+typedef signed __int64 DECLSPEC_ALIGN(8) INT64, *PINT64;
typedef unsigned char UINT8, *PUINT8;
typedef unsigned short UINT16, *PUINT16;
typedef unsigned int UINT32, *PUINT32;
-typedef unsigned __int64 UINT64, *PUINT64;
+typedef unsigned __int64 DECLSPEC_ALIGN(8) UINT64, *PUINT64;
typedef signed int LONG32, *PLONG32;
typedef unsigned int ULONG32, *PULONG32;
typedef unsigned int DWORD32, *PDWORD32;
-typedef signed __int64 LONG64, *PLONG64;
-typedef unsigned __int64 ULONG64, *PULONG64;
-typedef unsigned __int64 DWORD64, *PDWORD64;
+typedef signed __int64 DECLSPEC_ALIGN(8) LONG64, *PLONG64;
+typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONG64, *PULONG64;
+typedef unsigned __int64 DECLSPEC_ALIGN(8) DWORD64, *PDWORD64;
/* Win32 or Win64 dependent typedef/defines. */
diff --git a/include/strmif.h b/include/strmif.h
index 1b0fb6d..1ff27d0 100644
--- a/include/strmif.h
+++ b/include/strmif.h
@@ -117,7 +117,7 @@
#define MAX_FILTER_NAME 128
typedef LONGLONG REFERENCE_TIME;
-typedef double REFTIME;
+typedef DOUBLE REFTIME;
typedef DWORD_PTR HSEMAPHORE;
diff --git a/include/winnt.h b/include/winnt.h
index 3316608..067fd29 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -319,13 +319,13 @@
/* 'Extended/Wide' numerical types */
#ifndef _ULONGLONG_
#define _ULONGLONG_
-typedef signed __int64 LONGLONG, *PLONGLONG;
-typedef unsigned __int64 ULONGLONG, *PULONGLONG;
+typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG;
+typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG;
#endif
#ifndef _DWORDLONG_
#define _DWORDLONG_
-typedef ULONGLONG DWORDLONG, *PDWORDLONG;
+typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG;
#endif
/* ANSI string types */
diff --git a/include/wtypes.h b/include/wtypes.h
index 8096615..e32c80d 100644
--- a/include/wtypes.h
+++ b/include/wtypes.h
@@ -184,8 +184,12 @@
} MSG, *PMSG, *NPMSG, *LPMSG;
#endif /* winnt.h */
+#if 0
typedef double DOUBLE;
+#else
+typedef double DECLSPEC_ALIGN(8) DOUBLE;
+#endif
#ifndef _PALETTEENTRY_DEFINED
#define _PALETTEENTRY_DEFINED
typedef struct tagPALETTEENTRY {
@@ -609,8 +613,12 @@
STATFLAG_NOOPEN = 2
} STATFLAG;
+#if 0
typedef double DATE;
+#else
+typedef double DECLSPEC_ALIGN(8) DATE;
+#endif
#if 0
typedef struct tagCY {
LONGLONG int64;
diff --git a/include/wtypes.idl b/include/wtypes.idl
index d51467d..6608f34 100644
--- a/include/wtypes.idl
+++ b/include/wtypes.idl
@@ -184,7 +184,11 @@
cpp_quote("#endif /* winnt.h */")
+cpp_quote("#if 0") /* for IDL only */
typedef double DOUBLE;
+cpp_quote("#else")
+cpp_quote("typedef double DECLSPEC_ALIGN(8) DOUBLE;")
+cpp_quote("#endif")
cpp_quote("#ifndef _PALETTEENTRY_DEFINED")
cpp_quote("#define _PALETTEENTRY_DEFINED")
@@ -563,7 +567,11 @@
/******************** OLE Automation ********************/
+cpp_quote("#if 0") /* for IDL only */
typedef double DATE;
+cpp_quote("#else")
+cpp_quote("typedef double DECLSPEC_ALIGN(8) DATE;")
+cpp_quote("#endif")
cpp_quote("#if 0") /* for IDL only */
typedef struct tagCY {