[Issue 17868] New: add pragma(crt_con/destructor[, priority])

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 1 14:01:15 UTC 2017


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

          Issue ID: 17868
           Summary: add pragma(crt_con/destructor[, priority])
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: code at dawg.eu

To allow people some low-level integration with CRT construction/destruction.
An optional priority between 101 and 65535 is supported by GCC/clang (using
sorted .init_array.* sections, e.g. .init_array.101).
We should match that C/C++ implementation.

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-destructor-function-attribute

There is also init_priority for C++ static initializers. It relies on the same
priority mechanism.

https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html#index-init_005fpriority-variable-attribute

The priority sorting is only implemented when using the GNU/Linux linker, we
need to check whether we can implement it for other platforms.

--


More information about the Digitalmars-d-bugs mailing list