Can D code be linked as part of C programs? (plug-ins in D?)

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Feb 28 12:47:59 PST 2009


On Sat, Feb 28, 2009 at 3:40 PM, kll <kl at mailinator.com> wrote:
> Can D code be linked as part of C programs?
>
> e.g. can I write Apache module (dynamically linked .so file) using D?

Sure.

> I wonder if that's a matter of sneaking in D's runtime, starting GC, etc., or is it not possible at all?

That's precisely what you do.  If you compile the D piece of your
program as a lib, including its runtime, you should be able to link C
code to it.  You'll have to call the runtime startup/teardown
functions yourself, but it should work.  I'm pretty sure people have
made Apache modules in D before.



More information about the Digitalmars-d mailing list