Hello,<div><br></div><div>I was trying to run the example on the Interfacing to C page (<a href="http://www.d-programming-language.org/interfaceToC.html">http://www.d-programming-language.org/interfaceToC.html</a>) and ran into few issues. To get it to work "as is" i was .dup(ing) strings into new chars with defined size and passing those with .ptr. Anyway it seemed like quite a bit of work for something simple so I added const in the signatures and things worked much more smoothly:</div>
<div><br></div><div><div>import std.stdio, std.string;</div><div><br></div><div>extern (C) int strcmp(const char* string1, const char* string2);</div><div><br></div><div>void main()</div><div>{</div><div> writeln(myDfunction("foo"));</div>
<div>}</div><div><br></div><div>int myDfunction(const char[] s) {</div><div> return strcmp(std.string.toStringz(s), "foo");</div><div>}</div></div><div><br></div><div>Was there a reason why the consts were left out? </div>
<div>if this is a typo I'd be happy to update the web page, would be good experience for a noob like me. (never used GIT before and first time participating in a community)</div><div><br></div><div>Thanks,</div><div>Josh </div>