Creating weak symbols with D

Stefan Koch uplink.coder at googlemail.com
Sat Aug 8 18:14:34 UTC 2020


On Saturday, 8 August 2020 at 17:59:08 UTC, Andrei Alexandrescu 
wrote:
> Weak symbols (https://en.wikipedia.org/wiki/Weak_symbol) are 
> not often needed, but they are, they're needed badly.
>
> C and C++ define __attribute__((weak)) to introduce weak 
> symbols. It would be great if D could have a corresponding 
> @weak attribute.

pragma(weak) sounds better to me.
pragmas are suppose to change codgen, and the usecase is seldom 
enough that you wouldn't want to take name for it.

Out of interested where do you find yourself needing to specify 
weak linkage?


More information about the Digitalmars-d mailing list