[libcxx-commits] [PATCH] D61123: [libc++] Set _LIBCPP_DLL_VIS on _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS in MinGW mode

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 25 03:07:09 PDT 2019


mstorsjo created this revision.
mstorsjo added reviewers: rnk, hans, smeenai, mclow.lists, EricWF, ldionne.
Herald added a subscriber: dexonsmith.

Contrary to MSVC, MinGW compilers wants the dllexport attribute on the declaration of an explicit template instantiation, not on the definition.

GCC has always handled these attributes this way, and Clang is being made to match in D61118 <https://reviews.llvm.org/D61118>.

This is one of the parts necessary for building libc++ as a DLL on MinGW without forcibly exporting all symbols using `--export-all-symbols`. (In addition to this, another few tweaks to clang are needed.)


Repository:
  rCXX libc++

https://reviews.llvm.org/D61123

Files:
  include/__config


Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -668,8 +668,13 @@
 #  define _LIBCPP_EXPORTED_FROM_ABI
 #elif defined(_LIBCPP_BUILDING_LIBRARY)
 #  define _LIBCPP_DLL_VIS __declspec(dllexport)
-#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
-#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
+#  if defined(__MINGW32__)
+#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
+#    define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
+#  else
+#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
+#    define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
+#  endif
 #  define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
 #  define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
 #else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61123.196597.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190425/9423895f/attachment-0001.bin>


More information about the libcxx-commits mailing list