Calling D from C

Sean Kelly sean at invisibleduck.org
Mon Mar 12 10:25:27 PDT 2012


On Mar 12, 2012, at 9:54 AM, Stewart Gordon <smjg_1998 at yahoo.com> wrote:

> On 12/03/2012 15:38, Steven Schveighoffer wrote:
> <snip>
>>> http://dlang.org/phobos/core_runtime.html#initialize
>>> 
>>> And actually, I think this should do everything necessary. No need to call gc_init and
>>> thread_attachThis().
>> 
>> Hm... just realized you can't do this, since it's a D function :D
> 
> Why can't this be dealt with using an extern (C) wrapper function in the D code?

D function names are mangled based on the name of the module they're defined in. For the runtime code, it's easier to wrap extern C calls with D functions. 


More information about the Digitalmars-d mailing list