<div dir="ltr">On Wed, Jun 26, 2013 at 10:35 AM, Nico Rieck <span dir="ltr"><<a href="mailto:nico.rieck@gmail.com" target="_blank">nico.rieck@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 26.06.2013 02:57, Daniel Dilts wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When I was looking at libc++ it didn’t appear to support Windows except maybe under MinGW.  What would be a good place to start to get libc++ to work on Windows?<br>
</blockquote>
<br></div>
I've been working on this on and off. Here's a braindump of what's needed:<br>
<br>
1. Port OS-specific things.<br>
<br>
   This is rather small and I've done most of this already.<br>
<br>
2. C Standard Library.<br>
<br>
   Microsoft's CRT is a royal PITA. It doesn't support a lot of things<br>
   required or expected, and other things have subtle differences.<br>
   Which is why I wrote a new standard library to make point 1 easier.<br>
   At first it was only a set of standard-compliant headers and<br>
   implementation stubs to get it to compile, but I've since<br>
   implemented certain parts. The hardest part for this route is, for<br>
   me at least, libm, and I don't know any modern BSD-licensed libm<br>
   that could be used.<br>
   The other way would be to further try and shoehorn MSVCRT and give<br>
   up C99- and full C++11-compatibility.<br></blockquote><div><br></div><div>Can you give some examples of why using MSVCRT is hard?  I would expect most subtle behavior changes could be overcome, but I'm curious what the blockers are.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3. Implement full dllimport/dllexport semantics so that libc++ can be<br>
   used as a DLL.<br>
<br>
   Clang only support rudimentary dllimport/dllexport for functions.<br>
   Making it work with classes is a rather large non-trivial change.<br>
   I've been working on this and apart from vtable-handling and<br>
   cleanups it's mostly finished. Depending on that last point I may<br>
   put up some patches for review soon.<br>
<br>
   This also requires changes to how libc++ applies those attributes.<br>
   Using them like ELF visibility doesn't work correctly for templates.<br>
<br>
4. Weak externals for PE to enable replacing operator new/delete.<br>
<br>
   This was impossible with how dllimport was represented in LLVM<br>
   before. If my patches are excepted, it should be doable, but I<br>
   haven't looked into it again.<br>
<br>
5. Port an ABI library like libc++abi.<br>
<br>
   I've ported some parts of libc++abi, but it's incomplete and<br>
   untested. It also needs an unwind library, which quickly leads<br>
   to the next point:<br></blockquote><div><br></div><div>Yep, hard.</div></div></div></div>