[cfe-dev] Visibility in libc++
Nico Rieck
nico.rieck at gmail.com
Tue Jul 9 06:50:00 PDT 2013
Hi,
libc++ applies visibility default to all public types and functions,
including templates. On Windows these visibility macros expand to
dllexport/import which makes no sense for templates (If someone uses a
vector<int> it is then expected that something else is exporting such a
specialization).
Before I send a patch I have two questions:
1. AFAICS the visibility attributes were added for cases when the
libc++ headers are included inside of visibility scopes. Could
someone clarify why visibility is needed on header-only templates?
2. If these are indeed needed, then templates require a different macro
that only expands to visibility. I currently use
_LIBCPP_(TYPE|FUNC)_PUBLIC for both, and _LIBCPP_(TYPE|FUNC)_VIS for
only visibility. Thoughts?
-Nico
More information about the cfe-dev
mailing list