www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20144] New: standard pragma for weak linkage

https://issues.dlang.org/show_bug.cgi?id=20144

          Issue ID: 20144
           Summary: standard pragma for weak linkage
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

Marking symbols with weak linkage is common, and necessary in a lot of designs.
Currently, describing weak linkage is implementation dependent, and also
platform dependent.

Since D doesn't have a preprocessor, and we have no aliasing mechanism for
attributes or pragmas, it's impossible to wrangle all of this into one
expression.

The language needs to specify a weak linkage pragma, which can be mapped
appropriately everywhere.

`pragma(weak, true) void fun() {}` for instance; please choose you preferred
name.

GDC/LDC will map this to their backend directly (where they currently expose
implementation defined attributes), DMD needs to implement this, which is
mostly trivial.

Posix just flags it in the output, and MS/Windows does this by embedding a
linker directive in the output.

We need this. It is time.

--
Aug 19 2019