extern __gshared const(char)* symbol fails
James Blachly
james.blachly at gmail.com
Fri Aug 31 18:49:26 UTC 2018
On Friday, 31 August 2018 at 17:18:58 UTC, Neia Neutuladh wrote:
> On Friday, 31 August 2018 at 06:20:09 UTC, James Blachly wrote:
>> Hi all,
>>
>> ...
>>
>> When linking to this library from D, I have declared it as:
>>
>> extern __gshared const(char)* seq_nt16_str;
>>
>> ***But this segfaults when I treat it like an array (e.g. by
>> accessing members by index).***
>
> I believe this should be extern extern(C)? I'm surprised that
> this segfaults rather than having a link error.
>
> A bare `extern` means "this symbol is defined somewhere else".
>
> `extern(C)` means "this symbol should have C linkage".
>
I am so sorry -- I should have been more clear that this is in
the context of a large header-to-D translation .d file, so the
whole thing is wrapped in extern(C) via an extern(C): at the top
of the file.
More information about the Digitalmars-d-learn
mailing list