On Wednesday, 20 February 2013 at 14:36:56 UTC, bearophile wrote:
Chris:

extern (C) {export void printThis(char* str);}

Maybe the D wiki should contain info to save some time and experiments to people.

I agree and I am glad that the people on this forum are always willing to help. I will soon be able to write a book about interfacing to D (via C) from various languages, ha ha!

Possible alternative syntax:

extern(C) export void printThis(char* str);

Also, think if you want some const:

extern(C) export void printThis(const(char)* str);

Yep, const is next on my list.

By the way, Python could call the functions in the DLL _without_ extern (C). The name would be mangled though, e.g.:

lib.D8abairDLL10printThisFxPaZv(...)

It wasn't until arguments were passed to D that the problems kicked in.

Reply via email to