[libcxx] r319816 - Enable auto-linking on Windows

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 11:32:49 PST 2017


Author: compnerd
Date: Tue Dec  5 11:32:49 2017
New Revision: 319816

URL: http://llvm.org/viewvc/llvm-project?rev=319816&view=rev
Log:
Enable auto-linking on Windows

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.

Modified:
    libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=319816&r1=319815&r2=319816&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Dec  5 11:32:49 2017
@@ -1265,6 +1265,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 # endif
 #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
 
+#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
+# if defined(_DLL)
+#   pragma(lib, "c++.lib")
+# else
+#   pragma(lib, "libc++.lib")
+# endif
+#endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
 
 #endif // __cplusplus
 




More information about the cfe-commits mailing list