<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=windows-1252"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
The odds of #define _WINNT_H working are incredibly slim :)<br>
<br>
You can't include the separate headers (winbase.h etc), you have to
just include windows.h<br>
<br>
Windows defines IMAGE_* whether we like it or not, we can't stop it
doing it, so the only reasonable solution is to change LLVM to have
it's own set of constant names.<br>
<br>
Nick Kledzik wrote:
<blockquote cite="mid:4A80E5E4-C9D0-4315-A363-EDDB38D339FE@apple.com"
 type="cite">
  <pre wrap="">In the Windows SDK headers, is the IMAGE_* defines in a separate file (e.g. winint.h)?  Does the file have a guard against multiple inclusion?  If so (and the guard was named _WINNT_H_), perhaps you can do something like:

#define _WINNT_H_
#include <windows.h>

So you would get everything except those file format defines.  Of course, this would fail if other parts of the windows header rely on stuff declared in the the file being excluded.

Alternately, could you include the lower level windows headers rather than the top level windows.h (e.g #include <winbase.h> but not <windows.h>)

[I've never done Windows development, so I'm just stabbing in the dark here]

-Nick

On Aug 28, 2013, at 7:19 PM, Virgile Bello wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">It was happening in a few files using COFF.h in LLDB for the windows branch (Windows.h is required for some typedef over Mutex, thread, socket, etc...).

As said before, I am currently checking if it could be avoided (probably some refactoring will be needed). However I was wondering if it might not be easier to just avoid this clash at all by avoiding it in LLVM.

Alternatively I could #undef everything right after including Windows.h.


On Thu, Aug 29, 2013 at 11:08 AM, Nick Kledzik <a class="moz-txt-link-rfc2396E" href="mailto:kledzik@apple.com"><kledzik@apple.com></a> wrote:

On Aug 28, 2013, at 7:05 PM, Virgile Bello <a class="moz-txt-link-rfc2396E" href="mailto:virgile.bello@gmail.com"><virgile.bello@gmail.com></a> wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Right now, we have:
In COFF.h:
    class COFF { enum MachineTypes { IMAGE_FILE_MACHINE_UNKNOWN   = 0x0, ... }; };
In windows.h:
    #define IMAGE_FILE_MACHINE_UNKNOWN 0

* If you first include COFF.h and then windows.h,
    COFF::IMAGE_FILE_MACHINE_UNKNOWN
will be preprocessed into
    COFF:0.

* If you first include Windows.h and then COFF.h, COFF.h won't work because it's enum will become:
    enum MachinTypes { 0 = 0x0 };
      </pre>
    </blockquote>
    <pre wrap="">Sorry, I was not clear.  Why is Windows.h being included at all?  That header does not exist on some OS’s so the code would not build be portable.  If this use is in the one or two files of llvm that implement platform support, why is COFF.h being included in those instances?

-Nick


    </pre>
    <blockquote type="cite">
      <pre wrap="">
On Thu, Aug 29, 2013 at 6:03 AM, Nick Kledzik <a class="moz-txt-link-rfc2396E" href="mailto:kledzik@apple.com"><kledzik@apple.com></a> wrote:

On Aug 27, 2013, at 5:56 PM, Virgile Bello <a class="moz-txt-link-rfc2396E" href="mailto:virgile.bello@gmail.com"><virgile.bello@gmail.com></a> wrote:

      </pre>
      <blockquote type="cite">
        <pre wrap="">Yes of course I understand it was done on purpose.
It's just that it makes it impossible to include COFF.h and Windows.h side by side (which probably wasn't necessary until now).
        </pre>
      </blockquote>
      <pre wrap="">I too am in the camp that it is a feature to use the standard names.  For instance doing a search it google or github of the documented names will find uses.

Where exactly is the conflict happening?    Is the problem that something in llvm is including windows.h?  Or that some std lib C/C++ header is being included and the OS provided std header is including windows.h?  

-Nick
      </pre>
    </blockquote>
    <pre wrap="">
    </pre>
  </blockquote>
  <pre wrap=""><!---->

_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
  </pre>
</blockquote>
</body>
</html>