Cannot compile betterC app in windows using stderr

Walter Bright newshound2 at digitalmars.com
Fri Feb 4 04:11:37 UTC 2022


On 2/3/2022 11:55 AM, kinke wrote:
> * Template culling. If the compiler e.g. sees a stderr instantiation in druntime 
> in the import graph, it may decide not to emit the stderr symbol into the 
> betterC binary, assuming that druntime will be linked anyway.
> * Potentially a DSO-local stderr symbol for each binary (executable or 
> DLL/.so/.dylib), so that changing it in one DSO might not change it for the 
> whole process.
> 
> There have been previous 'dummy-templatizations' in druntime/Phobos to work 
> around missing symbols with -betterC. IMO, that's just patching over the cracks 
> of the -betterC hack and pessimizing regular D, and in case it's not obvious, 
> I'm definitely no fan of this. :)

"Header only" libraries work well for C++. We can make it work for D. In fact, 
we have to.

As for stderr, it should never be an instance of the iob itself. That instance 
resides only in the C stdlib. stderr should only be an indirect reference to it, 
hence multiple instances of stderr should work just fine.

With a bit of careful library design, we can make this work.


More information about the Digitalmars-d mailing list