Calling D functions from C

Robert Fraser fraserofthenight at
Tue May 27 03:35:25 PDT 2008

Pontus Pihlgren wrote:
> Hi all.
> Its a rather hypothetical I guess, but is it possible to call D 
> functions from C? If so, are there limitations?
> Kind Regards,
> Pontus.

extern(C) your D functions & enjoy! If you're not running the D garbage 
collector, don't rely on garbage collection happening (obvious), and a 
bit less obvious is that many libraries require their static 
constructors to be called, so be sure to run those first. Also, don't 
throw exceptions over D-C lines. There's probably other limitations I'm 
not thinking of/don't know of.

More information about the Digitalmars-d-learn mailing list