function without "this" cannot be const?

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 20 18:04:32 PST 2015


On Monday, 21 December 2015 at 02:03:14 UTC, Shriramana Sharma 
wrote:
> I'm trying to interface to a C function:
>
> extern(C) const char * textAttrN(const char * specString, 
> size_t n);
>
> and getting the error:
>
> Error: function <src>.textAttrN without 'this' cannot be const
>
> Please advise as to what I'm doing wrong?! :-(

Change it to:

extern(C) const(char)* textAttrN(const char * specString, size_t 
n);
                ^    ^



More information about the Digitalmars-d-learn mailing list