[PATCH] D40660: Enable auto-linking on Windows

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 30 17:01:07 PST 2017


compnerd added inline comments.


================
Comment at: include/__config:1267
+# if defined(_DLL) && !defined(_LIBCPP_BUILDING_LIBRARY)
+#   if defined(_LIBCPP_DEBUG)
+#     pragma comment(lib, "c++d.lib")
----------------
smeenai wrote:
> compnerd wrote:
> > smeenai wrote:
> > > I guess `_DLL` is appropriate here. Ideally though I think adding the pragma should be keyed on exactly the same conditional that determines whether we annotate with dllexport/dllimport, and right now that's only conditional on `_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS`.
> > Its more complicated.  This is for the *user* not the library itself.  When building the shared library we need to ensure that it is not added (`!defined(_LIBCPP_BUILDING_LIBRARY)`).  When using the headers as a user, the `_DLL` tells you about the dynamic/static behavior.
> I know, but the dllimport annotations are also for the *user*. If you're getting the dllimport annotations, you should also be getting the pragma, and vice-versa.
Right, but `_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS` does not imply use of a static libc++, but `!defined(_DLL)` does, unless Im missing something.  So doesn't this do exactly what you were thinking of?


Repository:
  rCXX libc++

https://reviews.llvm.org/D40660





More information about the cfe-commits mailing list