Shared library with C API

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon May 26 09:33:27 PDT 2014


Hi Etienne!

On Monday, 26 May 2014 at 12:50:59 UTC, Etienne Cimon wrote:
> On 2014-05-26 02:16, Kai Nacke wrote:
> Would that mean I have to call rt_init() at the start of every 
> function?

No. Just call rt_init() before you call the first D function. You 
should also call rt_term() e.g. on program shutdown. This makes 
sure that the D runtime is initialized properly and that 
resources are freed on shutdown.
You should also make sure that no D exception escapes as C has no 
exception handling and D exceptions are not compatible with C++ 
exceptions.

Regards,
Kai


More information about the digitalmars-d-ldc mailing list