extern(C) in druntime

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 11 08:52:04 PST 2014


On 11/11/14 11:01 AM, Dicebot wrote:
> On Monday, 10 November 2014 at 23:22:00 UTC, Sean Kelly wrote:
>> On Monday, 10 November 2014 at 23:08:55 UTC, Logan Capaldo wrote:
>>>
>>> So just to be clear, there are _some_ legitimate uses of extern (C)
>>> in druntime, yes? rt_init/rt_term, rt_loadLibrary, thread_init(?
>>> think this one can be bootstrapped from D code), ...?
>>
>> Yes.  There are a few functions meant to be callable from C code:
>> rt_init, rt_term, thread_attachThis, thread_detachThis, etc.  These
>> could either be exposed as wrappers on top of extern (D) functions or
>> left as-is.
>
> Well this is exactly what makes somewhat uneasy about making the change
> myself - it isn't immediately obvious which functions are legitimately
> extern(C) and which have it only for mangling / forward declaration.

I think make the PR, and we can debate which ones shouldn't be changed. 
I would also at least mark these ones that shouldn't be changed as 
"intended to be called from C/C++" with a comment to prevent accidental 
changes in the future.

-Steve


More information about the Digitalmars-d mailing list