Re: DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-18 Thread rikki cattermole via Digitalmars-d-learn
On 19/02/2019 6:26 AM, DanielG wrote: In the meantime, while I'm waiting for this bug to be noticed by anybody with the skills to address it, what would be the most elegant way of working around it? Obviously I could do a: version(Windows) {   export extern __gshared ... } else {   extern _

Re: DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-18 Thread DanielG via Digitalmars-d-learn
In the meantime, while I'm waiting for this bug to be noticed by anybody with the skills to address it, what would be the most elegant way of working around it? Obviously I could do a: version(Windows) { export extern __gshared ... } else { extern __gshared ... } But what's the minimal wa

Re: DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-08 Thread DanielG via Digitalmars-d-learn
On Friday, 8 February 2019 at 09:19:12 UTC, rikki cattermole wrote: File, inconsistent behavior is inconsistent. Not good. done: https://issues.dlang.org/show_bug.cgi?id=19660

Re: DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-08 Thread rikki cattermole via Digitalmars-d-learn
On 08/02/2019 9:14 PM, DanielG wrote: On Friday, 8 February 2019 at 07:52:26 UTC, Kagamin wrote: AFAIK, export attribute doesn't do much on posix platforms. I created a minimal example and it definitely segfaults at runtime in the presence of "export" (on Mac, haven't tested linux). So it's

Re: DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-08 Thread DanielG via Digitalmars-d-learn
On Friday, 8 February 2019 at 07:52:26 UTC, Kagamin wrote: AFAIK, export attribute doesn't do much on posix platforms. I created a minimal example and it definitely segfaults at runtime in the presence of "export" (on Mac, haven't tested linux). So it's required for Windows and silently evil

Re: DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-07 Thread Kagamin via Digitalmars-d-learn
On Friday, 8 February 2019 at 05:28:30 UTC, DanielG wrote: Is this correct behavior? It's correct for Windows: address of imported data is not known at link time and must use dynamic linkage. AFAIK, export attribute doesn't do much on posix platforms.

Re: DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-07 Thread DanielG via Digitalmars-d-learn
Follow-up: The problem on DMD macOS is the "export" keyword. It ended up in my code during a similar-ish problem last year, when I was having trouble linking against DLL global variables on Windows. If I remove the "export" keyword in the D interface, it will work on macOS but break on Windo

DMD: can't get extern __gshared to work right (vs. LDC)

2019-02-06 Thread DanielG via Digitalmars-d-learn
macOS 12, DMD 2.084.0 / LDC 1.14.0-beta1 I have a C API that exports some global variables, declared like so: .h file: = extern "C" { #define PUBLIC_API __attribute__((visibility("default"))) struct __opaqueHandle; typedef __opaqueHandle* opaqueHandle_t; PUBLIC_API extern const opaqueHandl