[PATCH] D40660: Enable auto-linking on Windows

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 11:47:17 PST 2017


smeenai added a comment.

I'm fine with future proofing, but not if it doesn't actually work in the present :)



================
Comment at: include/__config:1267
+# if defined(_DLL) && !defined(_LIBCPP_BUILDING_LIBRARY)
+#   if defined(_LIBCPP_DEBUG)
+#     pragma comment(lib, "c++d.lib")
----------------
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.


Repository:
  rCXX libc++

https://reviews.llvm.org/D40660





More information about the llvm-commits mailing list