On 26 Oct 2014 08:05, "Mike via Digitalmars-d" <digitalmars-d@puremagic.com> wrote:
>
> On Sunday, 26 October 2014 at 07:08:21 UTC, Mike wrote:
>
>> I tried this on my Linux desktop, and while everything compiled and linked without errors, it resulted in a segmentation fault at runtime.  But where I have failed, others may succeed.  I tested with LDC and GDC, but not DMD.
>
>
> It does work, but for some reason if I replace the printf statement below with D's writeln, I get a segmentation fault.  I don't know why.  Anywhere here's a trivial example to illustrate the idea.
>

The std.stdio module has a shared static this which initialises the File wrapper around C's stdin, stdout, and stderr.  I would first assume that it segv's because the wrapper or internal pointer is null.

Iain.