www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19660] New: 'export' keyword on OSX dynlib globals causing


          Issue ID: 19660
           Summary: 'export' keyword on OSX dynlib globals causing
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: redapple82570 gmail.com

Created attachment 1732
  --> https://issues.dlang.org/attachment.cgi?id=1732&action=edit
minimal example (Mac/Windows)

[DMD 2.084.0 on macOS 10.12]

The presence of 'export' on a global dynlib/DLL variable:

eg. "extern (C) export extern __gshared int someValue;"

... is causing inconsistent behavior between Mac/PC: keyword is required for
linking against DLL on Windows, but causes runtime segfaults* on Mac. Removing
'export' solves Mac crashes but then Windows linking fails.

* initially this issue was discovered due to the globals having incorrect
values. But the attached example is segfaulting.

LDC2 (1.14.0-beta1) does NOT exhibit the same issue.

Feb 08