Linking D code into existing C programs

Claude via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 27 01:50:51 PDT 2016


On Tuesday, 27 September 2016 at 08:12:58 UTC, Walter Bright 
wrote:
> On 9/27/2016 12:03 AM, Jacob Carlborg wrote:
>> You're not linking druntime.
>
> That's one issue. The other one is druntime needs to be 
> initialized, and calling a random D function won't do that.

We've got to consider that when it is statically linked, and also 
dynamically as well.

Also, if it's statically linked, will the linker just use parts 
of druntime that are actually used by the D libtrary?

For instance, if the D library does not use exceptions, ideally 
it should not link any related code in druntime (it's important, 
especially in embedded software).


More information about the Digitalmars-d mailing list