www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20627] New: Module ctors / dtors should always have D linkage

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 puremagic.com
          Reporter: pro.mathias.lang 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.

--
Mar 02