core.stdc and betterC

Walter Bright newshound2 at digitalmars.com
Sun Apr 29 22:52:29 UTC 2018


On 4/29/2018 8:40 AM, Jacob Carlborg wrote:
> Looks like "putchar" is inlined [1]. That means the "putchar" you're
> referencing is not the one in the C standard library but it's
> implemented in druntime. That means you need to link with
> druntime/phobos, it's not enough to link with the C standard library.
>
> I don't know why it was done this way. Perhaps it's just a macro on some
> platforms.
>
> [1]
> https://github.com/dlang/druntime/blob/master/src/core/stdc/stdio.d#L1289

It is a macro on some platforms, and that's why it was done that way in 
core.stdc.stdio. These days, however, it is better to replace such 
macros with a template. That way it will not be necessary to link with 
druntime.



More information about the Digitalmars-d mailing list