November 08, 2014 Re: Interfacing with C in 2.066.1 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to John Colvin | On Saturday, 8 November 2014 at 10:19:19 UTC, John Colvin wrote:
> On Saturday, 8 November 2014 at 10:03:51 UTC, Jason den Dulk wrote:
>> When upgrading my compiler from 2.065 to 2.066.1 I have encountered problems with some of my extern(C) code.
>>
>> My declarations (in a .di file) are wrapped in an extern(C) declaration. The code compiled fine in 2.065. In 2.066.1 it first complained about functions returning "const char *" ("function without this cannot be const").
>
> const char* foo() {}
>
> is a function that takes a const 'this' reference and returns char*
> You want
> const(char)* foo() {}
> or
> const(char*) foo() {}
Oh look, is THIS AGAIN. :(
| |||
November 08, 2014 Re: Interfacing with C in 2.066.1 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to fra | On Saturday, 8 November 2014 at 18:28:50 UTC, fra wrote:
> On Saturday, 8 November 2014 at 10:19:19 UTC, John Colvin wrote:
>> On Saturday, 8 November 2014 at 10:03:51 UTC, Jason den Dulk wrote:
>>> When upgrading my compiler from 2.065 to 2.066.1 I have encountered problems with some of my extern(C) code.
>>>
>>> My declarations (in a .di file) are wrapped in an extern(C) declaration. The code compiled fine in 2.065. In 2.066.1 it first complained about functions returning "const char *" ("function without this cannot be const").
>>
>> const char* foo() {}
>>
>> is a function that takes a const 'this' reference and returns char*
>> You want
>> const(char)* foo() {}
>> or
>> const(char*) foo() {}
>
> Oh look, is THIS AGAIN. :(
Yeah, this is causing a lot of confusion.
| |||
November 09, 2014 Re: Interfacing with C in 2.066.1 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Saturday, 8 November 2014 at 16:41:58 UTC, Daniel Murphy wrote:
> This symbol (`_D6jaypha5dbsql5mysql1c5mysql12st_mysql_res6__initZ') is the init data for the struct.
It looks as though the compiler is trying to create a instance of the struct
somewhere, but the source code doesn't ask for this. This is evidenced by the fact that when I remove the definition altogether, replacing it with a declaration, it works.
The compiler guys may ponder this if they wish. Since a workaround has been found I'll consider the subject closed. A thank you to everyone who contributed.
Regards
Jason
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply