[cfe-dev] CLang compiling windows.h from the Windows SDK

Clark Gaebel cg.wowus.cg at gmail.com
Sun Aug 8 17:02:09 PDT 2010


 Yes, but clang still fails without it, meaning it doesn't support
Windows out of the box. Is there a way to force the declaration in clang
itself?

On 08/08/10 19:57, Francois Pichet wrote:
> To get around this problem:
> I create a file inc.h containing just 1 forward declaration:
> struct IUnknown;
>
> Then I call clang using the force include option "-include inc.h"
> Work fine for me. For my needs, no patch needed in clang.
>
>
> On Sun, Aug 8, 2010 at 6:13 PM, Christopher Jefferson
> <chris at bubblescope.net> wrote:
>> On 8 Aug 2010, at 21:07, Douglas Gregor wrote:
>>
>>>> 3. CLang doesn't like:
>>>>    template<typename T> void** IID_PPV_ARGS_Helper(T** pp)
>>>>    {
>>>>       static_cast<IUnknown*>(*pp);            <=== clang error:
>>>> unknown type name 'IUnknown'
>>>>       return reinterpret_cast<void**>(pp);
>>>>    }
>>>> Note that 'IUnknown' is actually undefined at this point but MSVC accept it.
>>> Is it truly undeclared, or is it some kind of magic type? The former is very hard to deal with.
>> It is truly undeclared, this is due to windows being lax on what it accepts in templates. However, with some careful consideration, clang could possibly consider making it a magic type, if there is only a very small number of such hacks required to parse windows.h. I haven't done a careful analysis of how many such examples there are.
>>
>> Chris
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
Regards,
  -- Clark




More information about the cfe-dev mailing list