Creating weak symbols with D
sarn at theartofmachinery.com
Sun Aug 9 02:30:22 UTC 2020
On Saturday, 8 August 2020 at 18:43:31 UTC, Johan wrote:
> On Saturday, 8 August 2020 at 18:14:34 UTC, Stefan Koch wrote:
>> On Saturday, 8 August 2020 at 17:59:08 UTC, Andrei
>> Alexandrescu wrote:
>>> 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.
> This argumentation doesn't make sense to me. Not all pragmas
> change codegen, and there are many things that change codegen
> that are not pragmas.
Maybe the ship has already sailed, but existing linker-related
tweaks in standard D are done with pragmas (or extern). E.g.,
pragma(mangle) and pragma(crt_constructor).
More information about the Digitalmars-d