[Issue 20627] New: Module ctors / dtors should always have D linkage
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Mar  3 05:50:12 UTC 2020
    
    
  
https://issues.dlang.org/show_bug.cgi?id=20627
          Issue ID: 20627
           Summary: Module ctors / dtors should always have D linkage
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com
The following code:
```
module oops;
extern(C):
shared static this ()
{
   // Do stuff
}
```
Will emit the shared module constructor as `_sharedStaticDtor_L4_C1`.
Should another module have a similar definition, those functions would
conflict.
There is no reason for module constructors / destructors to have C linkage, and
its potential for symbol conflict means it should be deprecated.
--
    
    
More information about the Digitalmars-d-bugs
mailing list