I get an access violation with this code: extern(C) char* write(char* text);
void main(string[] args){ char[] text = "Hello World".dup; //.dup converts string to char[] text ~= '\0'; //append char* result = write(text.ptr); //you need .ptr const(char)[] s = cstr2dstr(result); writeln(s); readln(); //keep the window open } auto cstr2dstr(inout(char)* cstr) { return cstr ? cstr[0 .. strlen(cstr)] : ""; } -- #include std.stdio; char* write(char* text){ return text; }