1 /** 2 * @file basetyps.h 3 * Copyright 2012, 2013 MinGW.org project 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the next 13 * paragraph) shall be included in all copies or substantial portions of the 14 * Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 * DEALINGS IN THE SOFTWARE. 23 */ 24 #ifndef _BASETYPS_H 25 #define _BASETYPS_H 26 #pragma GCC system_header 27 #include <_mingw.h> 28 29 #ifndef _OBJC_NO_COM_ 30 # ifdef __cplusplus 31 # define EXTERN_C extern "C" 32 # else 33 # define EXTERN_C extern 34 # endif /* __cplusplus */ 35 # ifndef __int64 36 # define __int64 long long 37 # endif 38 # ifndef __int32 39 # define __int32 long 40 # endif 41 # ifndef __int16 42 # define __int16 short 43 # endif 44 # ifndef __int8 45 # define __int8 char 46 # endif 47 # ifndef __small 48 # define __small char 49 # endif 50 # ifndef __hyper 51 # define __hyper long long 52 # endif 53 # define STDMETHODCALLTYPE __stdcall 54 # define STDMETHODVCALLTYPE __cdecl 55 # define STDAPICALLTYPE __stdcall 56 # define STDAPIVCALLTYPE __cdecl 57 # define STDAPI EXTERN_C HRESULT STDAPICALLTYPE 58 # define STDAPI_(t) EXTERN_C t STDAPICALLTYPE 59 # define STDMETHODIMP HRESULT STDMETHODCALLTYPE 60 # define STDMETHODIMP_(t) t STDMETHODCALLTYPE 61 # define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE 62 # define STDAPIV_(t) EXTERN_C t STDAPIVCALLTYPE 63 # define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE 64 # define STDMETHODIMPV_(t) t STDMETHODVCALLTYPE 65 /* Newer MS compilers support the __interface keyword, but 66 that has a specific meaning that is enforced by the compiler. 67 For now, just get 'interface' out of the global namespace 68 for __OBJC__ */ 69 # define _COM_interface struct 70 # ifndef __OBJC__ 71 # define interface _COM_interface 72 # endif 73 # if defined(__cplusplus) && !defined(CINTERFACE) 74 # define STDMETHOD(m) virtual HRESULT STDMETHODCALLTYPE m 75 # define STDMETHOD_(t,m) virtual t STDMETHODCALLTYPE m 76 # define PURE =0 77 # define THIS_ 78 # define THIS void 79 # define DECLARE_INTERFACE(i) _COM_interface i 80 # define DECLARE_INTERFACE_(i,b) _COM_interface i : public b 81 # else 82 # define STDMETHOD(m) HRESULT(STDMETHODCALLTYPE *m) 83 # define STDMETHOD_(t,m) t(STDMETHODCALLTYPE *m) 84 # define PURE 85 # define THIS_ INTERFACE *, 86 # define THIS INTERFACE * 87 # ifndef CONST_VTABLE 88 # define CONST_VTABLE 89 # endif 90 # define DECLARE_INTERFACE(i) \ 91 typedef _COM_interface i { CONST_VTABLE struct i##Vtbl *lpVtbl; } i; \ 92 typedef CONST_VTABLE struct i##Vtbl i##Vtbl; \ 93 CONST_VTABLE struct i##Vtbl 94 # define DECLARE_INTERFACE_(i,b) DECLARE_INTERFACE(i) 95 # endif 96 # define BEGIN_INTERFACE 97 # define END_INTERFACE 98 99 # define FWD_DECL(i) typedef _COM_interface i i 100 # if defined(__cplusplus) && !defined(CINTERFACE) 101 # define IENUM_THIS(T) 102 # define IENUM_THIS_(T) 103 # else 104 # define IENUM_THIS(T) T* 105 # define IENUM_THIS_(T) T*, 106 # endif 107 # define DECLARE_ENUMERATOR_(I,T) \ 108 DECLARE_INTERFACE_(I,IUnknown) \ 109 { \ 110 STDMETHOD(QueryInterface)(IENUM_THIS_(I) REFIID,PVOID*) PURE; \ 111 STDMETHOD_(ULONG,AddRef)(IENUM_THIS(I)) PURE; \ 112 STDMETHOD_(ULONG,Release)(IENUM_THIS(I)) PURE; \ 113 STDMETHOD(Next)(IENUM_THIS_(I) ULONG,T*,ULONG*) PURE; \ 114 STDMETHOD(Skip)(IENUM_THIS_(I) ULONG) PURE; \ 115 STDMETHOD(Reset)(IENUM_THIS(I)) PURE; \ 116 STDMETHOD(Clone)(IENUM_THIS_(I) I**) PURE; \ 117 } 118 # define DECLARE_ENUMERATOR(T) DECLARE_ENUMERATOR_(IEnum##T,T) 119 120 #endif /* _OBJC_NO_COM_ */ 121 122 #ifdef _GUID_DEFINED 123 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead 124 #endif 125 126 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in winnt.h */ 127 #define GUID_DEFINED 128 typedef struct _GUID 129 { 130 unsigned long Data1; 131 unsigned short Data2; 132 unsigned short Data3; 133 unsigned char Data4[8]; 134 } GUID,*REFGUID,*LPGUID; 135 #endif /* GUID_DEFINED */ 136 #ifndef UUID_DEFINED 137 #define UUID_DEFINED 138 typedef GUID UUID; 139 #endif /* UUID_DEFINED */ 140 #ifndef __IID_DEFINED__ 141 #define __IID_DEFINED__ 142 typedef GUID IID; 143 #endif /* __IID_DEFINED__ */ 144 typedef GUID CLSID; 145 typedef CLSID *LPCLSID; 146 typedef IID *LPIID; 147 typedef IID *REFIID; 148 typedef CLSID *REFCLSID; 149 typedef GUID FMTID; 150 typedef FMTID *REFFMTID; 151 typedef unsigned long error_status_t; 152 #define uuid_t UUID 153 typedef unsigned long PROPID; 154 155 #ifndef _REFGUID_DEFINED 156 #if defined (__cplusplus) && !defined (CINTERFACE) 157 #define REFGUID const GUID& 158 #define REFIID const IID& 159 #define REFCLSID const CLSID& 160 #define REFFMTID const FMTID& 161 #else 162 #define REFGUID const GUID* const 163 #define REFIID const IID* const 164 #define REFCLSID const CLSID* const 165 #define REFFMTID const FMTID* const 166 #endif 167 #define _REFGUID_DEFINED 168 #define _REFIID_DEFINED 169 #define _REFCLSID_DEFINED 170 #define _REFFMTID_DEFINED 171 #endif 172 /* FIXME: This shouldn't be needed. 173 #ifndef GUID_SECTION 174 #define GUID_SECTION ".text" 175 #endif 176 */ 177 #define GUID_SECT 178 #if !defined(INITGUID) || (defined(INITGUID) && defined(__cplusplus)) 179 #define GUID_EXT EXTERN_C 180 #else 181 #define GUID_EXT 182 #endif 183 #ifdef INITGUID 184 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} 185 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) 186 #else 187 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n 188 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) 189 #endif 190 #endif 191