D.gnu - The garbage collector is closing stdout on powerpc-linux-gnu...
- Matt Brandt (15/15) Mar 12 2007 The following trivial program shows the problem:
- Matt Brandt (3/3) Mar 16 2007 After a bit of experimentation I've tracked this problem down to the fac...
The following trivial program shows the problem: ---------- import std.stdio; import std.gc; void main(char[][] args) { writefln("before full_collect"); fullCollect(); writefln("after full_collect"); } ----------------- when this is run the first message prints, but the second message doesn't. I've verified that the file descriptor (2) is actually closed by substituting a direct call to C write for the output statements as well. I'm running a gdc 0.22/gcc-4.1.0 cross compiler (on x86). Needless to say, it makes debugging difficult when output goes away... Any ideas? Matt
Mar 12 2007
After a bit of experimentation I've tracked this problem down to the fact that I compiled my libgphobos as a shared library. If I move the shared library aside so that libgphobos.a is used to link statically then everything works as expected. I'm guessing that this really boils down to the garbage collector not assigning root to some of the data areas in the shared library, but not knowing much about the garbage collector code it will be a slow ride to victory. If anyone out there is familiar with the garbage collector enough to help debug this problem I'll be happy to provide my makefile for building a shared libgphobos so you can duplicate the effect. I doubt that it is really architecture specific... Matt
Mar 16 2007