[patch] [libcxx] _LIBCPP_WEAK

Nico Rieck nico.rieck at gmail.com
Thu Sep 26 06:25:17 PDT 2013


On 26.09.2013 14:49, G M wrote:
> First: I take it from what you say my patch *as it stands* is correct?

I haven't had a chance to look at it. I was just responding to the 
question about the macro.

> Do you mean "LIBCPP_NEW_DELETE_VIS expands to _LIBCPP_FUNC_VIS_ONLY when
> using libc++ [as a static library]" or in some other context?

When used as static or shared library. The decision depends on 
cxx_EXPORTS, and this macro is only ever defined by CMake when building 
libc++ as a shared DLL on Windows.
The visibility macros expand to dllexport/dllimport as needed, but as 
I've explained, operator new/delete are special and must not be 
dllimport. Otherwise, if you replace the operators, you would try to 
import a local definition.

> Third:
> Are you saying we can't decorate the definition with _LIBCPP_NEW_DELETE_VIS
> or is that ok? just not to apply _LIBCPP_FUNC_VIS here. Or must it be
> nothing at all (other than _LIBCPP_WEAK) which is as I am tempted to read
> your words.

It doesn't matter, visibility and DLL attributes can be repeated. Though 
declaration and definition should at least be consistent. Depending on 
how the current issue of dllexport vs. visibility is resolved, providing 
both could give an error in the future.

-Nico



More information about the cfe-commits mailing list