D-DLLs & Python

Chris wendlec at tcd.ie
Wed Feb 20 04:48:52 PST 2013


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


More information about the Digitalmars-d-learn mailing list