On 11/10/2014 03:48 PM, Steven Schveighoffer wrote:
Opinion from those in the know:

When extern(C) is used in druntime, my understanding is that the reason
is twofold:

1. Because the compiler requires certain symbols for hooks.
2. To get around some requirements that "druntime knows better", such as
purity for things like memory allocation that touch global state.

Sometimes that might be required, but those "hacks" should be on the implementation not the call site.

I made a template to bind extern(D) function and I'd like to see it replacing most of the extern(C) bindings. It allows typesafe and attribute-correct bindings and things break if they aren't kept in sync.

https://github.com/D-Programming-Language/druntime/search?q=externDFunc

Reply via email to