[PATCH] D40660: Enable auto-linking on Windows

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 10:02:25 PST 2017


compnerd created this revision.
Herald added a subscriber: cfe-commits.

The MSVC driver and clang do not link against the C++ runtime
explicitly.  Instead, they rely on the auto-linking via the pragma
(through `use_ansi.h`) to link against the correct version of the C++
runtime.  Attempt to do something similar here so that linking real C++
code on Windows does not require the user to explicitly specify
`c++.lib` when using libc++ as a C++ runtime on windows.


Repository:
  rCXX libc++

https://reviews.llvm.org/D40660

Files:
  include/__config


Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -1263,6 +1263,15 @@
 # endif
 #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)

+#if defined(_LIBCPP_ABI_MICROSOFT)
+# if defined(_LIBCPP_BUILDING_LIBRARY)
+#   if defined(_LIBCPP_DEBUG)
+#     pragma(lib, "c++d.lib")
+#   else
+#     pragma(lib, "c++.lib")
+#   endif
+# endif
+#endif // defined(_LIBCPP_ABI_MICROSOFT)

 #endif // __cplusplus



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40660.124962.patch
Type: text/x-patch
Size: 489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171130/c295c900/attachment.bin>


More information about the llvm-commits mailing list