Re: extern __gshared const(char)* symbol fails

2018-09-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 31 August 2018 at 18:49:26 UTC, James Blachly wrote: 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

Re: extern __gshared const(char)* symbol fails

2018-09-01 Thread Edgar Huckert via Digitalmars-d-learn
On Friday, 31 August 2018 at 17:50:17 UTC, Steven Schveighoffer wrote: ... When you use const char* in D, it's expecting a *pointer* to be stored at that address, not the data itself. So using it means segfault. The static array is the correct translation, even though it leaks implementation

Re: extern __gshared const(char)* symbol fails

2018-08-31 Thread James Blachly via Digitalmars-d-learn
On Friday, 31 August 2018 at 17:50:17 UTC, Steven Schveighoffer wrote: What the C compiler is doing is storing it as data, and then storing the symbol to point at the first element in the data. When you use const char* in D, it's expecting a *pointer* to be stored at that address, not the

Re: extern __gshared const(char)* symbol fails

2018-08-31 Thread James Blachly via Digitalmars-d-learn
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

Re: extern __gshared const(char)* symbol fails

2018-08-31 Thread nkm1 via Digitalmars-d-learn
On Friday, 31 August 2018 at 06:20:09 UTC, James Blachly wrote: Hi all, I am linking to a C library which defines a symbol, const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN"; In the C sources, this is an array of 16 bytes (17 I guess, because it is written as a string). In the C headers, it

Re: extern __gshared const(char)* symbol fails

2018-08-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/31/18 2:20 AM, James Blachly wrote: Hi all, I am linking to a C library which defines a symbol, const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN"; In the C sources, this is an array of 16 bytes (17 I guess, because it is written as a string). In the C headers, it is listed as extern

Re: extern __gshared const(char)* symbol fails

2018-08-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/31/18 1:18 PM, Neia Neutuladh wrote: On Friday, 31 August 2018 at 06:20:09 UTC, James Blachly wrote: Hi all, I am linking to a C library which defines a symbol, const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN"; In the C sources, this is an array of 16 bytes (17 I guess, because it is

Re: extern __gshared const(char)* symbol fails

2018-08-31 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 31 August 2018 at 06:20:09 UTC, James Blachly wrote: Hi all, I am linking to a C library which defines a symbol, const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN"; In the C sources, this is an array of 16 bytes (17 I guess, because it is written as a string). In the C headers, it

extern __gshared const(char)* symbol fails

2018-08-31 Thread James Blachly via Digitalmars-d-learn
Hi all, I am linking to a C library which defines a symbol, const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN"; In the C sources, this is an array of 16 bytes (17 I guess, because it is written as a string). In the C headers, it is listed as extern const char seq_nt16_str[]; When linking to