www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17868] New: add pragma(crt_con/destructor[, priority])

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 puremagic.com
          Reporter: code 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.

--
Oct 01