[cfe-dev] libc++ in Windows

Óscar Fuentes ofv at wanadoo.es
Sun Jun 30 09:42:42 PDT 2013


Nico Rieck <nico.rieck at gmail.com> writes:

> 3. Implement full dllimport/dllexport semantics so that libc++ can be
>    used as a DLL.
>
>    Clang only support rudimentary dllimport/dllexport for functions.
>    Making it work with classes is a rather large non-trivial change.
>    I've been working on this and apart from vtable-handling and
>    cleanups it's mostly finished. Depending on that last point I may
>    put up some patches for review soon.
>
>    This also requires changes to how libc++ applies those attributes.
>    Using them like ELF visibility doesn't work correctly for templates.

Seeing all the VC++ ABI related churn on the commits lists I was puzzled
about the lack of dllexport capabilities of Clang, which is a pretty
basic feature. Now your message explains it.

> 6. Exception handling
>
>    This is probably the biggest hurdle. There is some low-level support
>    for 64-bit SEH directives in LLVM already. 32-bit has the additional
>    Borland patent issue for SEH exception handling. The data structures
>    used by MSVC are also undocumented.
>    Implementing this for 64-bit by using the DWARF exception tables and
>    providing an appropriate personality routine is the easiest case,
>    and would also allow catching SEH exceptions from the OS.
>    Maybe it's also possible to implement such DWARF-based table-based
>    exception handling for 32-bit, without any way to catch SEH
>    exceptions.

This is big issue indeed. Currently, 32bit MinGW is severely handicapped
for some C++ performance-critical applications, not because GCC produces
worse code than VS (it doesn't, in my experience) but because the
exception models available to MinGW are inadequate: you can choose to
slowdown the application (sjlj) or make it crash (dw2). Obviously, Clang
would suffer from the the same problem and implementing SEH seems like
the only remedy. Considering that the Borland patent expires in exactly
a year from now, there is time enough for completing the job and it will
be usable on a not so distant future :-)

As for the undocumented data structures, I'm allmost certain that you
know this article, but just in case:

http://www.microsoft.com/msj/0197/exception/exception.aspx

Thanks for all your work. I'll be very happy to have an option to VS.
I'll be glad to help testing it.

Regards.




More information about the cfe-dev mailing list