I tried extern (C) which has some advantages. However, it still doesn't produce the desired result (tried slicing too).

extern(C) {
  export void synthesize(ref char[] str) {
        printf("Incoming printf: %s\n", &str);
        writefln("writefln %s", &str);
        writefln("writefln %s", to!string(&str));
        writefln("writefln %s", to!string(str));
  }
}

OUTPUT:

Incoming printf: Hello from Python
writefln 2366A34
writefln 2366A34
Traceback (most recent call last):
  File "loaddll.py", line 4, in <module>
    lib.printThis(c_char_p("Hello from Python"))
WindowsError: [Error -532414463] Windows Error 0xE0440001

Reply via email to