Interfacing with C in 2.066.1
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 8 02:19:17 PST 2014
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() {}
If you do want a const 'this' then you should write:
char* foo() const {}
More information about the Digitalmars-d
mailing list