Thread overview
[Issue 17035] extern(C) and extern(C++) module ctor/dtor should behave like the C init/fini functions
Dec 28, 2016
David Nadlinger
May 21, 2018
Manu
Feb 19, 2020
Mathias LANG
December 28, 2016
https://issues.dlang.org/show_bug.cgi?id=17035

David Nadlinger <code@klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@klickverbot.at

--- Comment #1 from David Nadlinger <code@klickverbot.at> ---
LDC has been supporting this for a while with a compiler-specific pragma: https://wiki.dlang.org/LDC-specific_language_changes#LDC_global_crt_ctor_and_LDC_global_crt_dtor

Tying this to extern(C)/extern(C++) might look nicer syntactically, although
I'm not sure about conflating what usually concerns ABI (in the wider sense)
with runtime behaviour. Either way, since it is quite a sharp tool (no
guarantees about runtime/GC initialisation), we should make sure to handle
deprecation properly – "extern(C):" and "shared static this" (order!) might
already be used in the same file and would change meaning.

--
May 21, 2018
https://issues.dlang.org/show_bug.cgi?id=17035

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |turkeyman@gmail.com

--- Comment #2 from Manu <turkeyman@gmail.com> ---
This please!
I've just run into a case of this.

--
February 19, 2020
https://issues.dlang.org/show_bug.cgi?id=17035

Mathias LANG <pro.mathias.lang@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |pro.mathias.lang@gmail.com
         Resolution|---                         |DUPLICATE

--- Comment #3 from Mathias LANG <pro.mathias.lang@gmail.com> ---
We now have `pragma(crt_constructor)` and `pragma(crt_destructor)`, which cover
this use case. So the feature is here, just with a different syntax. Marking as
duplicate of the issue that was fixed (although it was filed 1 year after).

*** This issue has been marked as a duplicate of issue 17868 ***

--