Argh - no way to edit.

What's best practice here?

D strings are not null-terminated.
===
cpling.c

char* cpling(char *s)
{
  s[0]='!';
  return s;
}
===
dcaller.d

extern(C) char* cpling(char* s);

void callC()
{
  writefln("%s",fromStringz(cpling("hello\0")));
}

or

void callC()
{
  writefln("%s",fromStringz(cpling(toStringz("hello"))));
}

===

am I missing a better way to do this?

Reply via email to