I'm getting an unhelpful linker error, what've I got wrong?

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 28 05:10:52 PDT 2015


On Wednesday, 28 October 2015 at 11:48:27 UTC, pineapple wrote:
> On Wednesday, 28 October 2015 at 11:40:14 UTC, tcak wrote:
>> The "writebuffer" is defined to take an array as parameter. 
>> Yet, you are passing a pointer and a length to it. Instead, 
>> pass the parameter "str" to it directly. Also, you do not have 
>> to put "!char" to there. Compiler will solve it out by itself.
>
> There's also a writebuffer method in the interface with this 
> signature, though:
>
>     streamint writebuffer(T)(in T* buffer, in streamint count);
>
> And regardless, changing the problematic code to this doesn't 
> address the linker error:
>
>     final streamint writestring(in char[] str){
>         return this.writebuffer(str);
>     }
>     final streamint writestring(in string str){
>         return this.writebuffer(str);
>     }

This still doesn't solve everything, but the first thing to do is 
to define a method for those in the interface as well.

streamint writebuffer(T)(in T* buffer, in streamint count)
streamint writebuffer(T)(in T* buffer, in streamint count, bool 
dynamic);


More information about the Digitalmars-d-learn mailing list