[PATCH] D101479: [Driver] Support libc++ in MSVC

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 5 23:52:19 PDT 2021


mstorsjo added a comment.

In D101479#2741223 <https://reviews.llvm.org/D101479#2741223>, @phosek wrote:

> In D101479#2741202 <https://reviews.llvm.org/D101479#2741202>, @mstorsjo wrote:
>
>> In D101479#2740895 <https://reviews.llvm.org/D101479#2740895>, @phosek wrote:
>>
>>> On other platforms the decision whether to use static or shared is controlled by `-static-libstdc++`, does CL have a similar flag or shall we support `-static-libstdc++` in MSVC driver as well?
>>
>> Hmm, well contrary to how `-static-libstdc++` works otherwise (you only need it while linking), you'd need to define `-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS` everwhere when compiling, if libc++ defaults to DLL linkage but you'd want to use a static version instead.
>>
>> Repeating the question - does the driver really need to know or care? Thanks to the autolinking directive in libc++ headers, the driver shouldn't need to explicitly link against the libc++ library at all?
>
> I'd be fine with that. Is that what CL does as well?

AFAIK yes. And it's header-based, so clang-cl does the same - if you include and use the MSVC C++ standard library headers, it'll implicitly link in that library too.

> Do we still need the `-libpath:` for the linker to find the library?

Ah, yes, that will be needed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101479/new/

https://reviews.llvm.org/D101479



More information about the cfe-commits mailing list